Hello :wave: I'm occasionally hitting `ClassNotFou...
# gradle
d
Hello 👋 I'm occasionally hitting
ClassNotFoundException
during the build
Copy code
Caused by: java.lang.ClassNotFoundException: kotlinx.coroutines.CoroutinesInternalError
Which generally implies some classpath issue. I'm using Gradle 6.8 with Kotlin 1.4.32 and coroutines 1.4.3. Wondering if anyone else encountered similar issue? While looking at the dependency tree (https://scans.gradle.com/s/uvf7bsxzvgwso/dependencies?dependencies=kotlinx-coroutines-core&expandAll) the only config on
kotlinx-coroutines-core
is from the
kotlinCompilerPluginClasspath
. When I run
gradle -q dependencies --configuration kotlinCompilerPluginClasspath
you can see that it comes from
kotlin-scripting-compiler-embeddable
Copy code
kotlinCompilerPluginClasspath
\--- org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:1.4.32
     +--- org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:1.4.32
     |    +--- org.jetbrains.kotlin:kotlin-scripting-common:1.4.32
     |    |    +--- org.jetbrains.kotlin:kotlin-stdlib:1.4.32
     |    |    |    +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.4.32
     |    |    |    \--- org.jetbrains:annotations:13.0
     |    |    \--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.8
     |    |         +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.71 -> 1.4.32 (*)
     |    |         \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.71 -> 1.4.32
     |    +--- org.jetbrains.kotlin:kotlin-scripting-jvm:1.4.32
     |    |    +--- org.jetbrains.kotlin:kotlin-script-runtime:1.4.32
     |    |    +--- org.jetbrains.kotlin:kotlin-stdlib:1.4.32 (*)
     |    |    \--- org.jetbrains.kotlin:kotlin-scripting-common:1.4.32 (*)
     |    +--- org.jetbrains.kotlin:kotlin-stdlib:1.4.32 (*)
     |    \--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.8 (*)
     \--- org.jetbrains.kotlin:kotlin-stdlib:1.4.32 (*)

(*) - dependencies omitted (listed previously)
and sure enough the published artifact references old version of coroutines -> https://repo1.maven.org/maven2/org/jetbrains/kotlin/kotlin-scripting-compiler-impl-e[…]e/1.4.32/kotlin-scripting-compiler-impl-embeddable-1.4.32.pom (release 1.5.10 still points to 1.3.8 coroutines as well). Any ideas why runtime dep would be blowing stuff up?
n
You say you are using coroutines 1.4.3 but you are actually using 1.3.8
d
my build dependencies are specifying coroutines 1.4.3 the above is from the kotlin compiler classpath that I don't have control over it
if you look at the build scan you can see the compile path is using 1.4.3
n
The build scan is a successful build
d
yes I'm getting those exceptions randomly
*and even with the exceptions I'm getting a successful build
n
do you have a build scan that shows what you are talking about?
n
Thanks. I look a look. Might be with filing a bug on youtrack.
Does forcing the buildscript classpath to use 1.4.2 fix the issue?
d
how would i force it? it looks like it is coming from plugins classpath (and I only specify JVM plugin -> https://github.com/ExpediaGroup/graphql-kotlin/blob/master/examples/build.gradle.kts#L5)
actually exception is thrown when executing my plugin which runs using Gradle worker api using its own configuration -> https://scans.gradle.com/s/uvf7bsxzvgwso/dependencies?focusedDependency=WzMsNCwxMjU1L[…]QsWzEyNTVdXV0&toggled=W1szXSxbMV0sWzMsNF0sWzMsNCxbMTI1NV1dXQ
ah wonder whether this is it ->
ktor-client-jackson
pulls in old version of
jackson-module-kotlin
(2.10.3) which in turn attempts to pull in old version of
kotlin-reflect
(1.3.61) which according to dependency tree is updated to correct one.....
jackson version did not make any difference....
i just noticed though that
ktor-client-cio-jvm
depends on
kotlinx-coroutines-core:1.4.2-native-mt
and it gets updated to
1.4.3
wonder whether that is causing issues
Copy code
org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2-native-mt -> 1.4.3
n
Nice find. Let me know if that works!
d
It looks like it is an issue with Ktor HttpClient CIO engine -> when I switched to different engine (Java 11 HttpClient) I no longer get the exception in the logs 🤞 that resolves it
n
🦜