Kotlin / kotlinx.coroutines

Library support for Kotlin coroutines
Apache License 2.0
12.97k stars 1.84k forks source link

Incompatible BOM/Dependency mismatches: java.lang.NoSuchMethodError: void kotlinx.coroutines.test.TestBuildersKt.runTest #3951

Closed NoPhaseNoKill closed 7 months ago

NoPhaseNoKill commented 10 months ago

The first issue:

java.lang.NoSuchMethodError: 'void kotlinx.coroutines.test.TestBuildersKt.runTest-8Mi8wO0$default(kotlin.coroutines.CoroutineContext, long, kotlin.jvm.functions.Function2, int, java.lang.Object)'
    at com.integraboost.extensions.TestInvocationListener.interceptTestMethod(TestInvocationListener.kt:32)
    at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(InterceptingExecutableInvoker.java:103)
    at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:93)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
    at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:156)
    at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:147)
    at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:86)
    at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(InterceptingExecutableInvoker.java:103)
    at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:93)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
    at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:92)
    at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:86)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:217)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:213)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:138)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:68)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
    at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
    at org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService$ExclusiveTask.compute(ForkJoinPoolHierarchicalTestExecutorService.java:202)
    at java.base/java.util.concurrent.RecursiveAction.exec(RecursiveAction.java:194)
    at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)
    at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1311)
    at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1841)
    at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1806)
    at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:177)

Now broken resolved dependencies (1.7.3)

image

Previously working resolved dependencies (1.6.4)

image

How to reproduce:

The second issue:

image

Let me know if you need anything else

dkhalanskyjb commented 7 months ago

Sorry, I don't know anything about how to work with Spring Boot, so I can't give any meaningful advice. This is an issue tracker for problems in kotlinx-coroutines. To get help with your build setup, please use Kotlin Slack or Stack Overflow.

That said, it looks like there is a separate classpath that Spring Boot uses, and you need to find some way to influence it. The easiest way to fix your immediate concern is to edit modules/integraBoostService/build.gradle.kts and change the Spring Boot version from 3.1.5 to 3.2.2 (and with it, the version of coroutines on which Spring Boot depends), but I think the problem of needing to set the Spring Boot classpath will come back eventually, so it's worth investigating how to solve this properly.

As for your second issue, the URL returns 404.