我正在使用Exposed作为我的数据库库,当我尝试运行代码时出现这些错误:
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
的代码段:
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")
}
我认为我正确地遵循了示例代码,但我不能弄清楚抛出这些代码的原因。
答案 0 :(得分:7)
您需要将kotlin-reflect
添加为项目的依赖项。