https://kotlinlang.org logo
#graphql-kotlin
Title
# graphql-kotlin
a

Arun Kumar

12/24/2021, 11:35 AM
Hi team, trying to add the
graphql-kotlin
plugin to our gradle project. However when I try to run build the project, getting the following error. Have anyone seen this before?
Copy code
Execution failed for task ':runtime-service-web:graphqlIntrospectSchema'.
> There was a failure while executing work items
   > A failure occurred while executing com.expediagroup.graphql.plugin.gradle.actions.IntrospectSchemaAction
      > Unable to run introspection query against the specified endpoint=<http://localhost:8080/graphql>
.
.
Caused by: java.lang.NoSuchMethodError: 'void kotlin.jvm.internal.MutablePropertyReference1Impl.<init>(java.lang.Class, java.lang.String, java.lang.String, int)'
        at io.ktor.utils.io.pool.DefaultPool$Companion$Top$1.<init>(DefaultPool.kt)
        at io.ktor.utils.io.pool.DefaultPool$Companion$Top$1.<clinit>(DefaultPool.kt)
        at io.ktor.utils.io.pool.DefaultPool.<clinit>(DefaultPool.kt:111)
        at io.ktor.utils.io.internal.ObjectPoolKt.<clinit>(ObjectPool.kt:12)
        at io.ktor.utils.io.ByteBufferChannel.<init>(ByteBufferChannel.kt:33)
        at io.ktor.utils.io.ByteChannelKt.ByteReadChannel(ByteChannel.kt:20)
        at io.ktor.utils.io.ByteChannelCtorKt.ByteReadChannel(ByteChannelCtor.kt:45)
        at io.ktor.client.engine.apache.ApacheRequestProducer.<init>(ApacheRequestProducer.kt:45)
        at io.ktor.client.engine.apache.ApacheEngine.execute(ApacheEngine.kt:36)
        at io.ktor.client.engine.HttpClientEngine$executeWithinCallContext$2.invokeSuspend(HttpClientEngine.kt:85)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
d

Dariusz Kuc

12/24/2021, 1:33 PM
No such method implies library version mismatch - libs were build with kotlin 1.5, check version of kotlin in your project
a

Arun Kumar

12/25/2021, 12:40 PM
Ah yeah, my gradle wrapper was using a older version of gradle (which had Kotlin 1.4). Thanks for the response 👍
👍 1
A follow up question on this. Should I add the
kotlinx-serialization
dependencies even when I want to use the default Jackson serializer with Spring Client? I am seeing the following error while initializing the Web client without the kotlinx-serialization dependencies.
Copy code
Caused by: java.lang.ExceptionInInitializerError: null\n\tat org.springframework.web.reactive.function.client.ExchangeStrategies.withDefaults(ExchangeStrategies.java:67)\n\tat org.springframework.web.reactive.function.client.DefaultWebClientBuilder.initExchangeStrategies(DefaultWebClientBuilder.java:302)\n\tat org.springframework.web.reactive.function.client.DefaultWebClientBuilder.build(DefaultWebClientBuilder.java:269)\n\tat com.expediagroup.graphql.client.spring.GraphQLWebClient.<init>(GraphQLWebClient.kt:37)\n\tat com.expediagroup.graphql.client.spring.GraphQLWebClient.<init>(GraphQLWebClient.kt:31)\n\tat com.dd.runtime.web.config.ClientFactory.provideLocalGraphQLClient(ClientFactory.kt:25)\n\tat com.dd.runtime.web.config.$ClientFactory$ProvideLocalGraphQLClient1Definition.build(Unknown Source)\n\tat io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:1979)\n\t... 48 common frames omitted

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.http.codec.support.DefaultClientCodecConfigurer]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: kotlinx/serialization/json/Json$Default\n\tat org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:224)\n\tat org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:146)\n\tat org.springframework.http.codec.CodecConfigurerFactory.create(CodecConfigurerFactory.java:72)\n\tat org.springframework.http.codec.ClientCodecConfigurer.create(ClientCodecConfigurer.java:77)\n\tat org.springframework.web.reactive.function.client.DefaultExchangeStrategiesBuilder.<init>(DefaultExchangeStrategiesBuilder.java:50)\n\tat org.springframework.web.reactive.function.client.DefaultExchangeStrategiesBuilder.<clinit>(DefaultExchangeStrategiesBuilder.java:40)\n\t... 56 common frames omitted\nCaused by: java.lang.NoClassDefFoundError: kotlinx/serialization/json/Json$Default\n\tat org.springframework.http.codec.support.BaseDefaultCodecs.getKotlinSerializationJsonDecoder(BaseDefaultCodecs.java:673)\n\tat org.springframework.http.codec.support.BaseDefaultCodecs.initObjectReaders(BaseDefaultCodecs.java:493)\n\tat org.springframework.http.codec.support.BaseDefaultCodecs.initReaders(BaseDefaultCodecs.java:178)\n\tat org.springframework.http.codec.support.BaseDefaultCodecs.<init>(BaseDefaultCodecs.java:168)\n\tat org.springframework.http.codec.support.ClientDefaultCodecsImpl.<init>(ClientDefaultCodecsImpl.java:52)\n\tat org.springframework.http.codec.support.DefaultClientCodecConfigurer.<init>(DefaultClientCodecConfigurer.java:35)\n\tat java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)\n\tat java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)\n\tat java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)\n\tat java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)\n\tat org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:211)\n\t... 61 common frames omitted

Caused by: java.lang.ClassNotFoundException: kotlinx.serialization.json.Json$Default\n\tat java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)\n\tat java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)\n\tat java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)\n\t... 72 common frames omitted
d

Dariusz Kuc

12/27/2021, 1:59 PM
You shouldnt have to. Spring generally attempts to configure itself based on some properties or classpath. I'd double check your classpath as it sounds like something is off.
🙏 1
7 Views