Kotlin + Spring boot + Webflux + Netflix DGS + Groovy 스택에서 개발 환경을 구현하던 중 발생한 여러 에러 중 하나
에러 로그
2023-05-01 23:13:35.236 WARN 5227 --- [ restartedMain] onfigReactiveWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webHandler' defined in class path resource [org/springframework/boot/autoconfigure/web/reactive/WebFluxAutoConfiguration$EnableWebFluxConfiguration.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'routerFunctionMapping' defined in class path resource [org/springframework/boot/autoconfigure/web/reactive/WebFluxAutoConfiguration$EnableWebFluxConfiguration.class]: Invocation of init method failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dgsGraphQlRouter' defined in class path resource [com/netflix/graphql/dgs/webflux/autoconfiguration/DgsWebFluxAutoConfiguration.class]: Unsatisfied dependency expressed through method 'dgsGraphQlRouter' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dgsWebfluxHttpHandler' defined in class path resource [com/netflix/graphql/dgs/webflux/autoconfiguration/DgsWebFluxAutoConfiguration.class]: Unsatisfied dependency expressed through method 'dgsWebfluxHttpHandler' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dgsReactiveQueryExecutor' defined in class path resource [com/netflix/graphql/dgs/webflux/autoconfiguration/DgsWebFluxAutoConfiguration.class]: Unsatisfied dependency expressed through method 'dgsReactiveQueryExecutor' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'schema' defined in class path resource [com/netflix/graphql/dgs/autoconfig/DgsAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [graphql.schema.GraphQLSchema]: Factory method 'schema' threw exception; nested exception is java.lang.NoSuchMethodError: 'graphql.schema.idl.RuntimeWiring graphql.schema.idl.RuntimeWiring.transform(java.util.function.Consumer)'
***************************
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.apollographql.federation.graphqljava.Federation.ensureFederationDirectiveDefinitionsExist(Federation.java:194)
The following method did not exist:
'graphql.schema.idl.RuntimeWiring graphql.schema.idl.RuntimeWiring.transform(java.util.function.Consumer)'
The calling method's class, com.apollographql.federation.graphqljava.Federation, was loaded from the following location:
jar:file:/Users/gimhoyeong/.gradle/caches/modules-2/files-2.1/com.apollographql.federation/federation-graphql-java-support/2.1.0/9ef0abf955406d2573e84990c05bc3fcb4b2404a/federation-graphql-java-support-2.1.0.jar!/com/apollographql/federation/graphqljava/Federation.class
The called method's class, graphql.schema.idl.RuntimeWiring, is available from the following locations:
jar:file:/Users/gimhoyeong/.gradle/caches/modules-2/files-2.1/com.graphql-java/graphql-java/18.3/d30b46b4db4818fc6547d233b7aef5af6dcfe715/graphql-java-18.3.jar!/graphql/schema/idl/RuntimeWiring.class
The called method's class hierarchy was loaded from the following locations:
graphql.schema.idl.RuntimeWiring: file:/Users/gimhoyeong/.gradle/caches/modules-2/files-2.1/com.graphql-java/graphql-java/18.3/d30b46b4db4818fc6547d233b7aef5af6dcfe715/graphql-java-18.3.jar
Action:
Correct the classpath of your application so that it contains compatible versions of the classes com.apollographql.federation.graphqljava.Federation and graphql.schema.idl.RuntimeWiring
원인
Spring boot v2.7.4 부터 종속성에 관한 문제가 생겼습니다.
자세한 정보: https://github.com/Netflix/dgs-framework/issues/1281
해결 방법
아래 코드를 `build.gradle.kts`에 삽입합니다.
dependencyManagement {
imports {
mavenBom("com.netflix.graphql.dgs:graphql-dgs-platform-dependencies:latest.release")
}
}
반응형