stuebingerb / KGraphQL

Pure Kotlin GraphQL implementation
MIT License
3 stars 1 forks source link

Fix: NoSuchFieldError in Ktor 3.0.0 #26

Closed Taskeren closed 3 days ago

Taskeren commented 1 week ago

Updated Ktor version to 3.0.0 and fixed the bug that causes NoSuchFieldError.

NoSuchFieldError will be thrown when using Ktor 3.0.0 and the latest KGQL 0.21.0.

Exception in thread "main" java.lang.NoSuchFieldError: Plugin
    at com.apurebase.kgraphql.GraphQL$FeatureInstance.install(KtorFeature.kt:106)
    at com.apurebase.kgraphql.GraphQL$Feature.install(KtorFeature.kt:60)
    at com.apurebase.kgraphql.GraphQL$Feature.install(KtorFeature.kt:54)
    at io.ktor.server.application.ApplicationPluginKt.install(ApplicationPlugin.kt:100)
    at cn.taskeren.explode.plugins.KGraphQLKt.configureKGraphQL(KGraphQL.kt:8)
    at cn.taskeren.explode.ApplicationKt.module(Application.kt:23)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at kotlin.reflect.jvm.internal.calls.CallerImpl$Method.callMethod(CallerImpl.kt:97)
    at kotlin.reflect.jvm.internal.calls.CallerImpl$Method$Static.call(CallerImpl.kt:106)
    at kotlin.reflect.jvm.internal.KCallableImpl.callDefaultMethod$kotlin_reflection(KCallableImpl.kt:207)
    at kotlin.reflect.jvm.internal.KCallableImpl.callBy(KCallableImpl.kt:112)
    at io.ktor.server.engine.internal.CallableUtilsKt.callFunctionWithInjection(CallableUtils.kt:120)
    at io.ktor.server.engine.internal.CallableUtilsKt.executeModuleFunction(CallableUtils.kt:36)
    at io.ktor.server.engine.EmbeddedServer.launchModuleByName$lambda$26(EmbeddedServerJvm.kt:354)
    at io.ktor.server.engine.EmbeddedServer.avoidingDoubleStartupFor(EmbeddedServerJvm.kt:378)
    at io.ktor.server.engine.EmbeddedServer.launchModuleByName(EmbeddedServerJvm.kt:353)
    at io.ktor.server.engine.EmbeddedServer.instantiateAndConfigureApplication$lambda$25(EmbeddedServerJvm.kt:334)
    at io.ktor.server.engine.EmbeddedServer.avoidingDoubleStartup(EmbeddedServerJvm.kt:360)
    at io.ktor.server.engine.EmbeddedServer.instantiateAndConfigureApplication(EmbeddedServerJvm.kt:332)
    at io.ktor.server.engine.EmbeddedServer.createApplication(EmbeddedServerJvm.kt:142)
    at io.ktor.server.engine.EmbeddedServer.start(EmbeddedServerJvm.kt:271)
    at io.ktor.server.netty.EngineMain.main(EngineMain.kt:25)

Just noticed that this fixed error occurred in #20.

stuebingerb commented 1 week ago

Thank you! I will have a look at some Ktor topics after my vacation (I would try to support 2 and 3). Please give me a few days 🙂

stuebingerb commented 3 days ago

fyi: I'm currently rewriting the Ktor feature to the new plugin API which should then hopefully work with both, 2.x and 3.x