Kotlin – NoClassDefFoundError when using exposed
•
Java
I use exposed as my database library. When I try to run my code, I encounter these errors:
Exception in thread "main" java.lang.NoClassDefFoundError: kotlin/reflect/full/KClasses at org.jetbrains.exposed.sql.Table.clone(Table.kt:196) at org.jetbrains.exposed.sql.Table.cloneWithAutoInc(Table.kt:234) at org.jetbrains.exposed.sql.Table.autoIncrement(Table.kt:238) at org.jetbrains.exposed.sql.Table.autoIncrement$default(Table.kt:238) at vanilla.jubeatbook.data.songs.<init>(sqlObjects.kt:14) at vanilla.jubeatbook.data.songs.<clinit>(sqlObjects.kt:13) at vanilla.jubeatbook.backend.MainKt$main$1.invoke(Main.kt:22) at vanilla.jubeatbook.backend.MainKt$main$1.invoke(Main.kt) at org.jetbrains.exposed.sql.transactions.ThreadLocalTransactionManagerKt.inTopLevelTransaction(ThreadLocalTransactionManager.kt:70) at org.jetbrains.exposed.sql.transactions.ThreadLocalTransactionManagerKt.transaction(ThreadLocalTransactionManager.kt:58) at org.jetbrains.exposed.sql.transactions.ThreadLocalTransactionManagerKt.transaction(ThreadLocalTransactionManager.kt:49) at vanilla.jubeatbook.backend.MainKt.main(Main.kt:21) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) Caused by: java.lang.ClassNotFoundException: kotlin.reflect.full.KClasses at java.net.urlclassloader.findClass(urlclassloader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 17 more
sqlObjects. KT code snippet:
object Songs : Table() { val _id = integer("_id").autoIncrement().primaryKey() // Line 14 val songId = integer("song_id") val title = text("title") val artist = text("artist") val levelBSC = integer("level_bsc") val levelADV = integer("level_adv") val levelEXT = integer("level_ext") }
I think I followed the sample code correctly, but I can't figure out why I threw it
Solution
You need to add kotlin reflect as a dependency of the project
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码