Hi Team , I just migrated to ktor 3.1.3 from 2.3.1...
# server
m
Hi Team , I just migrated to ktor 3.1.3 from 2.3.12 but not sure why call.receive is not working like its not converting my json into data class . This is the extension function i was using earlier but now its not working .
Copy code
suspend inline fun <reified T : Any> PipelineContext<*, ApplicationCall>.getBodyContent(): T {
    return call.receive()
}
i cant access it inside post block. Can anyone help
h
Not working could mean everything but nothing. What’s your exact error?
m
MB this is the error i get No Default Transformations found for class io.ktor.utils.io.ByteChannel and expected type TypeInfo(com.data.request.UserRequest) for call /v1/user/register
h
Did you setup content negotiation?
m
yes
Copy code
fun Application.configureSerialization() {
    install(ContentNegotiation) {
        gson {}
        json()
    }
}
I figured out something its not related to deserialization its something with koin java.lang.NoClassDefFoundError: io/ktor/server/routing/RoutingKt at org.koin.ktor.ext.RouteExtKt.getKoin(RouteExt.kt:74) at com.api.routes.UserRoutesKt$UserRoutes$$inlined$inject$default$1.invoke(RouteExt.kt:76) at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:83) at com.api.routes.UserRoutesKt.UserRoutes$lambda$0(UserRoutes.kt:25) at com.api.routes.UserRoutesKt.access$UserRoutes$lambda$0(UserRoutes.kt:1) at com.api.routes.UserRoutesKt$UserRoutes$1.invokeSuspend(UserRoutes.kt:29) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.internal.DispatchedContinuation.resumeWith(DispatchedContinuation.kt:197) at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(SuspendFunctionGun.kt:146) at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:120) at io.ktor.util.pipeline.SuspendFunctionGun.access$loop(SuspendFunctionGun.kt:11) at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(SuspendFunctionGun.kt:70) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100) at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:173) at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:166) at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:569) at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:998) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.base/java.lang.Thread.run(Thread.java:833)
v
What is the Koin version you are using? I think you need
4.1.0