Hi, I am trying to migrate from ktor 2.2.x to 3.0....
# ktor
n
Hi, I am trying to migrate from ktor 2.2.x to 3.0.1 and I am getting a very strange error:
Copy code
java.lang.NoSuchMethodError: 'kotlinx.coroutines.CoroutineDispatcher kotlinx.coroutines.CoroutineDispatcher.limitedParallelism$default(kotlinx.coroutines.CoroutineDispatcher, int, java.lang.String, int, java.lang.Object)'

	at io.ktor.test.dispatcher.TestCommonKt$runTestWithRealTime$1.invokeSuspend(TestCommon.kt:39)
	at io.ktor.test.dispatcher.TestCommonKt$runTestWithRealTime$1.invoke(TestCommon.kt)
	at io.ktor.test.dispatcher.TestCommonKt$runTestWithRealTime$1.invoke(TestCommon.kt)
	at kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt$runTest$2$1$1.invokeSuspend(TestBuilders.kt:316)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith$$$capture(ContinuationImpl.kt:33)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
	at kotlinx.coroutines.test.TestDispatcher.processEvent$kotlinx_coroutines_test(TestDispatcher.kt:24)
	at kotlinx.coroutines.test.TestCoroutineScheduler.tryRunNextTaskUnless$kotlinx_coroutines_test(TestCoroutineScheduler.kt:99)
	at kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt$runTest$2$1$workRunner$1.invokeSuspend(TestBuilders.kt:322)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith$$$capture(ContinuationImpl.kt:33)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
	at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:277)
	at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:95)
	at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:69)
	at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
	at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:48)
	at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
	at kotlinx.coroutines.test.TestBuildersJvmKt.createTestResult(TestBuildersJvm.kt:10)
	at kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt.runTest-8Mi8wO0(TestBuilders.kt:310)
	at kotlinx.coroutines.test.TestBuildersKt.runTest-8Mi8wO0(Unknown Source)
	at kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt.runTest-8Mi8wO0(TestBuilders.kt:168)
	at kotlinx.coroutines.test.TestBuildersKt.runTest-8Mi8wO0(Unknown Source)
	at io.ktor.test.dispatcher.TestCommonKt.runTestWithRealTime-8Mi8wO0(TestCommon.kt:38)
	at io.ktor.test.dispatcher.TestCommonKt.runTestWithRealTime-8Mi8wO0$default(TestCommon.kt:33)
	at io.ktor.server.testing.TestApplicationKt.testApplication(TestApplication.kt:375)
	at io.ktor.server.testing.TestApplicationKt.testApplication(TestApplication.kt:336)
	at com.paxos.services.testutils.StandardEndpointTests.testBlah(StandardEndpointTests.kt:145)
	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
That method does exist. I am using coroutines version
1.8.1
. I tried updating to
1.9.0
but still get the same problem. Very confused
a
Can you please check that you don't mix both versions of Ktor or of coroutines?
n
I have set the language version to 1.9. I think that might be the problem. Gradle doesn’t seem to support kotlin language 2.0 yet. I guess I need to wait.