0

我收到以下堆栈跟踪错误:

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,但没有看到任何丢失类的证据(据我所知)。还有其他原因我可能会在这里失踪吗?

4

1 回答 1

1

事实证明,工件已损坏。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

哪个是空的。

于 2019-04-08T10:52:56.077 回答