graphql-java-kickstart / graphql-spring-boot

GraphQL and GraphiQL Spring Framework Boot Starters - Forked from oembedler/graphql-spring-boot due to inactivity.
https://www.graphql-java-kickstart.com/spring-boot/
MIT License
1.5k stars 325 forks source link

Method does not exist using Kotlin and Spring boot #270

Closed delmania closed 5 years ago

delmania commented 5 years ago

Hello, I'm attempting to use the latest version in a Spring Boot application using Kotlin. When I try to run, I get the following error:

`


APPLICATION FAILED TO START


Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

com.coxautodev.graphql.tools.SchemaParserOptions$Builder.build(SchemaParserBuilder.kt:375)

The following method did not exist:

kotlinx.coroutines.Dispatchers.getDefault()Lkotlinx/coroutines/CoroutineDispatcher;

The method's class, kotlinx.coroutines.Dispatchers, is available from the following locations:

jar:file:/Users/delmania/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-compiler/1.3.11/da4c9bc184dce739ce73ebab50e73edbe89e7f0f/kotlin-compiler-1.3.11.jar!/kotlinx/coroutines/Dispatchers.class
jar:file:/Users/delmania/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-coroutines-core/1.2.1/3839faf625f4197acaeceeb6da000f011a2acb49/kotlinx-coroutines-core-1.2.1.jar!/kotlinx/coroutines/Dispatchers.class

It was loaded from the following location:

file:/Users/delmania/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-compiler/1.3.11/da4c9bc184dce739ce73ebab50e73edbe89e7f0f/kotlin-compiler-1.3.11.jar

Action:

Correct the classpath of your application so that it contains a single, compatible version of kotlinx.coroutines.Dispatchers `

My dependencies are dependencies { implementation("org.springframework.boot:spring-boot-starter-data-jpa") implementation("org.postgresql:postgresql:42.2.6") implementation("org.springframework.boot:spring-boot-starter-web") implementation("com.fasterxml.jackson.module:jackson-module-kotlin") implementation("org.jetbrains.kotlin:kotlin-reflect") implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") testImplementation("org.springframework.boot:spring-boot-starter-test") implementation("com.graphql-java-kickstart:graphql-spring-boot-starter:5.10.0") implementation("com.graphql-java-kickstart:graphiql-spring-boot-starter:5.10.0") implementation("io.arrow-kt:arrow-ank:0.9.0") }

Looking at dependency map, it looks like GraphHQL-Java-Tool is bring in its own version of the Couroutines?

oliemansm commented 5 years ago

Have you specified the kotlin version as described here: https://github.com/graphql-java-kickstart/graphql-spring-boot#warning-noclassdeffounderror-when-using-graphql-java-tools--54x? Could be it's caused by the same thing.