```May 22 17:13:36 preon bash[49023]: Exception in...
# coroutines
m
Copy code
May 22 17:13:36 preon bash[49023]: Exception in thread "DefaultDispatcher-worker-25" java.lang.NoClassDefFoundError: kotlinx/coroutines/CoroutineExceptionHandlerKt
May 22 17:13:36 preon bash[49023]:         at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:126)
May 22 17:13:36 preon bash[49023]:         at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:89)
May 22 17:13:36 preon bash[49023]:         at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:586)
May 22 17:13:36 preon bash[49023]:         at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:820)
May 22 17:13:36 preon bash[49023]:         at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:717)
May 22 17:13:36 preon bash[49023]:         at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:704)
May 22 17:13:36 preon bash[49023]: Caused by: java.lang.ClassNotFoundException: kotlinx.coroutines.CoroutineExceptionHandlerKt
May 22 17:13:36 preon bash[49023]:         ... 6 more
How do I fix this? I have kotlinx-coroutines-core in my shadowJar.
s
Stab in the dark, but errors like this can often be caused by runtime version mismatches, i.e. some code was compiled using version X of coroutines, but at runtime it ends up using version Y
m
I see, is there a way to check? All my dependencies should be up-to-date
s
In Gradle? I would start with the dependencyInsight task. You can ask it to tell you which of your dependencies require the coroutines library, and which version of it they're asking for (and which version they actually got)
Off the top of my head there's another possibility too, which is that a
NoClassDefFoundError
can actually be caused by an exception during static initialization of a class (i.e. the class does exist, but couldn't be loaded due to an error). It's worth looking closely at the whole stacktrace for any signs of that.
d
Also worth doing a "clean" build just in case.
💯 1