https://kotlinlang.org logo
Title
a

Alexander Schell

08/14/2020, 8:15 AM
OjWej, what have I done wrong this time? 😢
java.lang.NoClassDefFoundError: kotlin/coroutines/AbstractCoroutineContextKey
I thought adding kotlinx-coroutines-core to my pom.xml would be enough...? kotlin: 1.3.72 kotlinx-coroutines-core: 1.3.7 - Also tried it with 1.3.5: Same result...
g

gildor

08/14/2020, 9:01 AM
looks that you don’t have stdlib (or your stdblib is too old)
a

Alexander Schell

08/14/2020, 9:04 AM
Hello Andrey I'm using kotlin-stdlib-jdk8 in version 1.3.72. Will chekc if there is a more recent version. Thanks! Best regards Alex
g

gildor

08/14/2020, 9:07 AM
no 1.3.72 should be enough
maybe you have something like old kotlin-stdlib (which overrides jdk8 transitive dependecy)
kotlin-stdlib-jdk8 itself is a very small artifact which provides a few classes for Java 8 support, but it itself has kotlin-stdlib in dependencies
also, check that you don’t have
kotlin-stdlib-jre8
this is old name of the same artifact which existed before Kotlin 1.2, so it may also bring old stdlib to classpath and I not sure how maven dependency resolution will work in this case
a

Alexander Schell

08/14/2020, 9:11 AM
Hello Andrey Thanks for your help but just foget it: I'm as dumb as I'm tall... 🤪 I've fogotten to include kotlin-stdlib in my dependency-list... How embarrassing... 🙁 Best regards Alex
g

gildor

08/14/2020, 9:11 AM
kotlin-stdlib should be transitively added by kotlin-stdlib-jdk8, but again not very familiar with maven
a

Alexander Schell

08/14/2020, 9:16 AM
Yes, that's what puzzles me a little bit: The transitively added dependencies should be added to the class-path. I've added the dependency to my pom.xml explicitly now. And - Surprise! - it works like expected. Funny.
g

gildor

08/14/2020, 9:18 AM
That what I’m saying, maybe it was overwritten by another depedency, because in maven not always the nevest version is used (at least as I know), dependency resolution is different