我收到以下堆栈跟踪的错误:
java.lang.NoClassDefFoundError: com/github/jasync/sql/db/ConcreteConnectionBase$flatten$$inlined$mapTry$1
at com.github.jasync.sql.db.ConcreteConnectionBase.releaseIfNeeded(ConcreteConnectionBase.kt:98) [jasync-common-0.9.41.jar:?]
at com.github.jasync.sql.db.mysql.MySQLConnection.sendPreparedStatementDirect(MySQLConnection.kt:299) [jasync-mysql-0.9.41.jar:?]
at com.github.jasync.sql.db.ConcreteConnectionBase$sendPreparedStatement$1.invoke(ConcreteConnectionBase.kt:75) [jasync-common-0.9.41.jar:?]
at com.github.jasync.sql.db.ConcreteConnectionBase$sendPreparedStatement$1.invoke(ConcreteConnectionBase.kt:16) [jasync-common-0.9.41.jar:?]
at com.github.jasync.sql.db.interceptor.ConnectionInterceptorHelperKt.wrapPreparedStatementWithInterceptors(ConnectionInterceptorHelper.kt:35) [jasync-common-0.9.41.jar:?]
at com.github.jasync.sql.db.ConcreteConnectionBase.sendPreparedStatement(ConcreteConnectionBase.kt:67) [jasync-common-0.9.41.jar:?]
at com.github.jasync.sql.db.pool.ConnectionFactory.test(ConnectionFactory.kt:81) [jasync-common-0.9.41.jar:?]
at com.github.jasync.sql.db.pool.ConnectionFactory.test(ConnectionFactory.kt:14) [jasync-common-0.9.41.jar:?]
at com.github.jasync.sql.db.pool.ObjectPoolActor.sendAvailableItemsToTest(ActorBasedObjectPool.kt:342) [jasync-common-0.9.41.jar:?]
at com.github.jasync.sql.db.pool.ObjectPoolActor.handleTestAvailableItems(ActorBasedObjectPool.kt:282) [jasync-common-0.9.41.jar:?]
at com.github.jasync.sql.db.pool.ObjectPoolActor.onReceive(ActorBasedObjectPool.kt:226) [jasync-common-0.9.41.jar:?]
at com.github.jasync.sql.db.pool.ActorBasedObjectPool$actor$1.invokeSuspend(ActorBasedObjectPool.kt:141) [jasync-common-0.9.41.jar:?]
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:32) [kotlin-stdlib-1.3.10.jar:1.3.10-release-253 (1.3.10)]
at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:233) [kotlinx-coroutines-core-1.1.1.jar:?]
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:594) [kotlinx-coroutines-core-1.1.1.jar:?]
at kotlinx.coroutines.scheduling.CoroutineScheduler.access$runSafely(CoroutineScheduler.kt:60) [kotlinx-coroutines-core-1.1.1.jar:?]
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:742) [kotlinx-coroutines-core-1.1.1.jar:?]
Caused by: java.lang.ClassNotFoundException: com.github.jasync.sql.db.ConcreteConnectionBase$flatten$$inlined$mapTry$1
at java.net.URLClassLoader.findClass(URLClassLoader.java:381) [?:1.8.0_144]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) [?:1.8.0_144]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335) [?:1.8.0_144]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) [?:1.8.0_144]
... 17 more
您可以在此处查看ConcreteConnectionBase
类的源代码:https://github.com/jasync-sql/jasync-sql/blob/master/db-async-common/src/main/java/com/github/jasync/sql/db/ConcreteConnectionBase.kt
flatMapTry
和mapTry
是内联函数。奇怪的是,上面的堆栈跟踪不一致(即并非在所有实例上都发生(。
反编译了 jar,但没有看到任何缺失类的证据(据我所知(。我在这里可能遗漏了其他原因吗?
事实证明,工件已损坏。 gradle clean
解决了这个问题。
我找到它的方法是使用:
>jar tf jasync-common-0.9.24.jar | grep ConcreteConnectionBase | grep mapTry
com/github/jasync/sql/db/ConcreteConnectionBase$flatten$$inlined$mapTry$1$lambda$1.class
com/github/jasync/sql/db/ConcreteConnectionBase$flatten$$inlined$mapTry$1.class
并将其与以下人员进行比较:
>jar tf jasync-common-0.9.41.jar | grep ConcreteConnectionBase | grep mapTry
这是空的。