Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Springboot中解析graphql架构时出错,如何修复?_Spring_Spring Boot_Graphql_Graphql Java - Fatal编程技术网

在Springboot中解析graphql架构时出错,如何修复?

在Springboot中解析graphql架构时出错,如何修复?,spring,spring-boot,graphql,graphql-java,Spring,Spring Boot,Graphql,Graphql Java,我有一个项目,我正在使用Springboot和GraphQL 我在Gradle 5.6.2中使用Java11 在我的模块中,我为GraphQl添加了这些依赖项 // GraphQl implementation 'com.graphql-java-kickstart:graphql-spring-boot-starter:5.10.0' implementation 'com.graphql-java:graphiql-spring-boot-starter:5.0.2'

我有一个项目,我正在使用Springboot和GraphQL

我在Gradle 5.6.2中使用Java11

在我的模块中,我为GraphQl添加了这些依赖项

    // GraphQl
    implementation 'com.graphql-java-kickstart:graphql-spring-boot-starter:5.10.0'
    implementation 'com.graphql-java:graphiql-spring-boot-starter:5.0.2'
    implementation 'com.graphql-java-kickstart:voyager-spring-boot-starter:5.10.0'
    implementation 'com.graphql-java-kickstart:graphql-java-tools:5.6.1'
在我的
src/main/java/no.domain.project中,我有我的SpringBoot应用程序。我还有一个名为
RootResolver
的文件夹,我在其中添加了以下类:

@Component
public class RootResolver implements GraphQLQueryResolver{

    public String getHello() {
        return "Hello World";
    }
}
我的
schema.graphqls
具有以下查询:

type Query {
    hello: String!
}
我可以使用404访问
localhost:8080/grapiql

但当我运行该项目时,会出现以下错误:

Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'graphQLServletRegistrationBean' defined in class path resource [com/oembedler/moon/graphql/boot/GraphQLWebAutoConfiguration.class]: Unsatisfied dependency expressed through method 'graphQLServletRegistrationBean' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'graphQLHttpServlet' defined in class path resource [com/oembedler/moon/graphql/boot/GraphQLWebAutoConfiguration.class]: Unsatisfied dependency expressed through method 'graphQLHttpServlet' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'graphQLServletConfiguration' defined in class path resource [com/oembedler/moon/graphql/boot/GraphQLWebAutoConfiguration.class]: Unsatisfied dependency expressed through method 'graphQLServletConfiguration' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'invocationInputFactory' defined in class path resource [com/oembedler/moon/graphql/boot/GraphQLWebAutoConfiguration.class]: Unsatisfied dependency expressed through method 'invocationInputFactory' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'graphQLSchemaProvider' defined in class path resource [com/oembedler/moon/graphql/boot/GraphQLWebAutoConfiguration.class]: Unsatisfied dependency expressed through method 'graphQLSchemaProvider' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.oembedler.moon.graphql.boot.GraphQLJavaToolsAutoConfiguration': Unsatisfied dependency expressed through field 'options'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'schemaParserOptions' defined in no.inmeta.ris.web.Application: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.coxautodev.graphql.tools.SchemaParserOptions]: Factory method 'schemaParserOptions' threw exception; nested exception is java.lang.NoClassDefFoundError: kotlin/coroutines/ContinuationInterceptor

Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'graphQLHttpServlet' defined in class path resource [com/oembedler/moon/graphql/boot/GraphQLWebAutoConfiguration.class]: Unsatisfied dependency expressed through method 'graphQLHttpServlet' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'graphQLServletConfiguration' defined in class path resource [com/oembedler/moon/graphql/boot/GraphQLWebAutoConfiguration.class]: Unsatisfied dependency expressed through method 'graphQLServletConfiguration' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'invocationInputFactory' defined in class path resource [com/oembedler/moon/graphql/boot/GraphQLWebAutoConfiguration.class]: Unsatisfied dependency expressed through method 'invocationInputFactory' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'graphQLSchemaProvider' defined in class path resource [com/oembedler/moon/graphql/boot/GraphQLWebAutoConfiguration.class]: Unsatisfied dependency expressed through method 'graphQLSchemaProvider' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.oembedler.moon.graphql.boot.GraphQLJavaToolsAutoConfiguration': Unsatisfied dependency expressed through field 'options'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'schemaParserOptions' defined in no.inmeta.ris.web.Application: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.coxautodev.graphql.tools.SchemaParserOptions]: Factory method 'schemaParserOptions' threw exception; nested exception is java.lang.NoClassDefFoundError: kotlin/coroutines/ContinuationInterceptor

Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'graphQLServletConfiguration' defined in class path resource [com/oembedler/moon/graphql/boot/GraphQLWebAutoConfiguration.class]: Unsatisfied dependency expressed through method 'graphQLServletConfiguration' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'invocationInputFactory' defined in class path resource [com/oembedler/moon/graphql/boot/GraphQLWebAutoConfiguration.class]: Unsatisfied dependency expressed through method 'invocationInputFactory' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'graphQLSchemaProvider' defined in class path resource [com/oembedler/moon/graphql/boot/GraphQLWebAutoConfiguration.class]: Unsatisfied dependency expressed through method 'graphQLSchemaProvider' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.oembedler.moon.graphql.boot.GraphQLJavaToolsAutoConfiguration': Unsatisfied dependency expressed through field 'options'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'schemaParserOptions' defined in no.inmeta.ris.web.Application: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.coxautodev.graphql.tools.SchemaParserOptions]: Factory method 'schemaParserOptions' threw exception; nested exception is java.lang.NoClassDefFoundError: kotlin/coroutines/ContinuationInterceptor

Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'invocationInputFactory' defined in class path resource [com/oembedler/moon/graphql/boot/GraphQLWebAutoConfiguration.class]: Unsatisfied dependency expressed through method 'invocationInputFactory' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'graphQLSchemaProvider' defined in class path resource [com/oembedler/moon/graphql/boot/GraphQLWebAutoConfiguration.class]: Unsatisfied dependency expressed through method 'graphQLSchemaProvider' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.oembedler.moon.graphql.boot.GraphQLJavaToolsAutoConfiguration': Unsatisfied dependency expressed through field 'options'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'schemaParserOptions' defined in no.inmeta.ris.web.Application: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.coxautodev.graphql.tools.SchemaParserOptions]: Factory method 'schemaParserOptions' threw exception; nested exception is java.lang.NoClassDefFoundError: kotlin/coroutines/ContinuationInterceptor

Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'graphQLSchemaProvider' defined in class path resource [com/oembedler/moon/graphql/boot/GraphQLWebAutoConfiguration.class]: Unsatisfied dependency expressed through method 'graphQLSchemaProvider' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.oembedler.moon.graphql.boot.GraphQLJavaToolsAutoConfiguration': Unsatisfied dependency expressed through field 'options'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'schemaParserOptions' defined in no.inmeta.ris.web.Application: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.coxautodev.graphql.tools.SchemaParserOptions]: Factory method 'schemaParserOptions' threw exception; nested exception is java.lang.NoClassDefFoundError: kotlin/coroutines/ContinuationInterceptor

Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.oembedler.moon.graphql.boot.GraphQLJavaToolsAutoConfiguration': Unsatisfied dependency expressed through field 'options'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'schemaParserOptions' defined in no.inmeta.ris.web.Application: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.coxautodev.graphql.tools.SchemaParserOptions]: Factory method 'schemaParserOptions' threw exception; nested exception is java.lang.NoClassDefFoundError: kotlin/coroutines/ContinuationInterceptor

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'schemaParserOptions' defined in no.inmeta.ris.web.Application: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.coxautodev.graphql.tools.SchemaParserOptions]: Factory method 'schemaParserOptions' threw exception; nested exception is java.lang.NoClassDefFoundError: kotlin/coroutines/ContinuationInterceptor

我把错误信息短路了

是什么导致了这个问题。我看到它没有拾取我的模式,但为什么会这样?我看过很多教程都是这样做的,但是我发现了这个错误

有什么建议吗


谢谢你的帮助

我想:)我需要添加一个
gradle.properties
文件并添加
kotlin.version=1.3.50
,因为启动
SpringApplication
时会出现错误
NoClassDefFoundException
,因为
Spring Boot
会覆盖库正在使用的kotlin版本。

在graphiql端点中。我认为应该是
localhost:8080/graphiql