Arrow: NoClassDefFoundError on Kotlin 1.2.41

Created on 25 May 2018  路  22Comments  路  Source: arrow-kt/arrow

e: [kapt] An exception occurred: java.lang.NoClassDefFoundError: org/jetbrains/kotlin/serialization/jvm/JvmProtoBufUtil
    at me.eugeniomarletti.kotlin.metadata.KotlinClassMetadata$data$2.invoke(KotlinMetadata.kt:51)
    at me.eugeniomarletti.kotlin.metadata.KotlinClassMetadata$data$2.invoke(KotlinMetadata.kt:50)
    at kotlin.SynchronizedLazyImpl.getValue(Lazy.kt:131)
    at me.eugeniomarletti.kotlin.metadata.KotlinClassMetadata.getData(KotlinMetadata.kt)
    at arrow.optics.OptikalProcessor.evalAnnotatedElement(OpticsProcessor.kt:74)
    at arrow.optics.OptikalProcessor.onProcess(OpticsProcessor.kt:38)
    at arrow.common.utils.AbstractProcessor.process(AbstractProcessor.kt:20)
    at org.jetbrains.kotlin.kapt3.ProcessorWrapper.process(annotationProcessing.kt:131)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:794)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:70

All 22 comments

now this class seems to be in package org.jetbrains.kotlin.metadata.jvm.deserialization

as a workaround I used the following snapshot dependencies from jitpack:

compile group: 'com.github.arrow-kt.arrow', name: 'arrow-optics', version: '4c934edbda'
compile group: 'com.github.arrow-kt.arrow', name: 'arrow-effects', version: '4c934edbda'
kaptTest group: 'com.github.arrow-kt.arrow', name: 'arrow-annotations-processor', version: '4c934edbda'

We probably need to release a new version to fix this :) Ping @raulraja @JorgeCastilloPrz @nomisRev this weekend?

Definitely. Wasn't it already fixed on current master branch? (potential 0.7.2). I think @Takhion has the clues on where's the problem.

It was fixed in #821 and yeah apparently it's not released yet 馃榿

I'd love to wait for #860 and #856 if possible. I want to give those types a try along with FlowableK and ObservableK in a client project to validate the approach we have on those wrappers.

@JorgeCastilloPrz Single is already green, I don't expect Maybe to take long :D

Yeah I'll work on it today most likely.

SingleK and MaybeK are already in so I don't need anything else from my side. Can we proceed on releasing? How are releases done? Anything special to do other than tagging master? (Was it automatized @Guardiola31337?)

I was able to temporarily get a round t his by setting my project kotlin version to 1.2.31, seems to be caused by something ~other than arrow~ in kotlin or kapt. I didn't see this issue until I added kapt as a gradle plugin AND added annotations to generate higherkinds or optics.

The exemplar in this bug ticket includes the kapt plugin, but I didn't see a dependency on arrow:
https://youtrack.jetbrains.com/oauth?state=%2Fissue%2FKT-23902

@dgoetsch have you tried this?

@Takhion I did not try to specifically override the compiler-embedabble dependency, and I don't have dependencies on kotlin-metadata. I took the path of least resistance and set my kotlin dependency version to 1.2.31 rather than 1.2.41 in my buildscript, which in turn is used in the kotlin plugin dependency and the compile kotlin dependencies I use. Its weird because I know that arrow is compiled against 1.2.41, so I was anticipating problems from version mismatch. I also thought this might be an issue with java7 vs java8 (locally I switch between 8 and 9), but I had the same issue regardless of java version on kotlin 1.2.41.

I'm fine with temporarily downgrading. My only point is that I don't think this is caused by arrow nor that the fix is in this library since similar issues have been reported where arrow is not in use.

@dgoetsch the problem is that kotlin-metadata is not just being used by arrow, but also by other libraries (like Room)

Fixed in 0.7.2. Thanks everyone!

Setting Kotlin to version 1.2.31 has no effect on this error

@IgorGanapolsky have you updated to Arrow 0.7.2? It was a kotlin-metadata lib issue. Check with gradle whether you're pulling the latest version of it too.

@pakoito The strange thing is I'm not even using Arrow in my project. Still getting this error... See attached log.
build_log.zip

...

what

Update Eugenio's kotlin-metadata, or update any transitive libraries that use it. Check with gradle deps or another similar subcommand.

@pakoito There is no kotlin-metadata in my project whatsoever as far I can see. Must be some transitive dependency. This issue is fixed by deleting ~/.gradle/caches

Happy to hear that solved it. It's a weird issue indeed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

raulraja picture raulraja  路  5Comments

pakoito picture pakoito  路  4Comments

gortiz picture gortiz  路  3Comments

raulraja picture raulraja  路  4Comments

JorgeCastilloPrz picture JorgeCastilloPrz  路  5Comments