Caused by: java.lang.NoSuchMethodError kotlinx.coroutines.reactive.FlowSubscription when updating kotlinx-coroutines from 1.3.7 to 1.3.9
See original GitHub issueDear Kotlin-team,
I m having a rective spring-boot project (spring-boot version 2.3.3.). I updated Kotlin to version 1.4 and kotlinx-coroutines-core and kotlinx-coroutines-reactor to 1.3.9.
I am using spring-boot webclient to retrieve data.
return WebClient.create(url) .get() .retrieve() .bodyToFlow()
after I updated I am getting this exception:
Caused by: java.lang.NoSuchMethodError: kotlinx.coroutines.reactive.FlowSubscription.<init>(Lkotlinx/coroutines/flow/Flow;Lorg/reactivestreams/Subscriber;Lkotlin/coroutines/CoroutineContext;)V at kotlinx.coroutines.reactor.FlowAsFlux.subscribe(ReactorFlow.kt:39) at org.springframework.http.server.reactive.ChannelSendOperator.subscribe(ChannelSendOperator.java:77) at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64) at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:150) at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onNext(FluxOnErrorResume.java:73) at reactor.core.publisher.MonoCreate$DefaultMonoSink.success(MonoCreate.java:156) at kotlinx.coroutines.reactor.MonoCoroutine.onCompleted(Mono.kt:66) at kotlinx.coroutines.AbstractCoroutine.onCompletionInternal(AbstractCoroutine.kt:104) at kotlinx.coroutines.JobSupport.tryFinalizeSimpleState(JobSupport.kt:294) at kotlinx.coroutines.JobSupport.tryMakeCompleting(JobSupport.kt:853) at kotlinx.coroutines.JobSupport.makeCompletingOnce$kotlinx_coroutines_core(JobSupport.kt:825) at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:111) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46) at kotlinx.coroutines.DispatchedContinuationKt.resumeCancellableWith(DispatchedContinuation.kt:333)
In kotlinx-coroutines-core and kotlinx-coroutines-reactor to 1.3.7. it is working as expected.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (2 by maintainers)
Top GitHub Comments
The picture clearly shows that you have
kotlinx-coroutines-core:1.3.9
andkotlinx.coroutines-reactive:1.3.8
. It is not designed to work this way. Versions of different modules must match.I have just hit the same error on upgrading to 1.3.9, and the problems was that
kotlinx-coroutines-reactive:1.3.3
was somehow ending up in my classpath. The only way to fix it was to explicitly pull in the 1.3.9 version as well: