Reputation: 15365
I am getting an error with the following stacktrace:
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
You can see the source code for ConcreteConnectionBase
class here:
https://github.com/jasync-sql/jasync-sql/blob/master/db-async-common/src/main/java/com/github/jasync/sql/db/ConcreteConnectionBase.kt
flatMapTry
and mapTry
are inlined functions. The weird thing is that the above stacktrace is not consistent (ie not happening on all instances).
I decompiled the jar but didn't see any evidence of missing classes (as far as I understood it). Is there another cause I might be missing here?
Upvotes: 0
Views: 234
Reputation: 15365
It turns out the artifact was corrupted. gradle clean
fixed the issue.
The way I found it is by using:
>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
And comparing it with:
>jar tf jasync-common-0.9.41.jar | grep ConcreteConnectionBase | grep mapTry
Which was empty.
Upvotes: 1