java.lang.NoClassDefFoundError: kotlinx.coroutines.DelayWithTimeoutDiagnostics

Hi all !

I’m using kotlinx.coroutines.test => runTest function
but at runtime I’m facing this issue:
java.lang.NoClassDefFoundError: kotlinx.coroutines.DelayWithTimeoutDiagnostics

I don’t understand why.
I’m using Kotlin 1.8.2 with kotlinx 1.7.2 (latest versions of all).
If I look inside the library kotlinx.coroutines.test, I’m not able to see such a class:

And if I go to https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-delay-with-timeout-diagnostics/ I get a 404…

Can you explain me, please ?

Hello Alexandre,

I’d checked your links and kotlinx.coroutines GitHub, and didn’t find this as well. However I do see that this class is used as an interface for TestDispatcher in 1.7.2

After further investigation I do found it here Explain the test framework behavior in the withTimeout message (#3623) · Kotlin/kotlinx.coroutines@b6e1839 · GitHub

Let’s check if you have this interface in the Delay.kt of your dependencies.

1 Like

Hi !!! Thanks a lot for pointed me out to the file that is in Kotlinx Core. I found my issue.
Actually I’m using Exposed library, and this library only uses kotlinx 1.6.4 (this version does not include DelayWithTimeoutDiagnostics), so it’s eclipsing my pom version 1.7.2 of kotlinx.
Since I absolutely need “Exposed”, I have no other choice to roll back to the same version, 1.6.4, in my pom.

Thanks for your help, really precious !

1 Like