[DGS] GraphQLSchema: Factory method 'schema' threw exception; nested exception is java.lang.NoSuchMethodError 에러 해결

2023. 5. 1. 23:31·Framework & Runtime/SpringBoot

 

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")
    }
}

 

반응형
저작자표시 비영리 (새창열림)
'Framework & Runtime/SpringBoot' 카테고리의 다른 글
  • Spring boot RestClient H2C 설정
  • PageNotFound, No mapping for ... 로그 해결하기
  • spring-cloud-starter-aws artifact 를 사용할 때 org.springframework.cloud group 의 것은 사용하지 마세요
  • java.lang.IllegalArgumentException: Malformed escape pair at index 해결
Kua
Kua
정보 공유, 개인 정리 공간 입니다.
  • Kua
    Kua's Miscellaneous
    Kua
    • 분류 전체보기 (185)
      • 대문 (2)
      • Tips (25)
        • Chrome (2)
        • Windows (4)
        • IDE (3)
        • 기타 (16)
      • CodingTest (44)
      • Language (20)
        • PHP (5)
        • C# (7)
        • Java (1)
        • Kotlin (7)
      • Framework & Runtime (16)
        • SpringBoot (12)
        • Node.js (2)
        • Vue.js (1)
        • Gradle (1)
      • DevOps (13)
        • Linux (1)
        • Docker (4)
        • Kubernetes (2)
        • Apache Kafka (1)
        • AWS (1)
      • 일상다반사 (53)
        • 도서 (1)
        • 개발 (8)
        • 후기 - IT (7)
        • 후기 - 일상 (13)
        • 차가리 (4)
        • 방송통신대학교 (4)
        • 음식 (2)
      • Games (12)
        • Minecraft (7)
        • VR (2)
        • 그외 (3)
  • 최근 글

  • 인기 글

  • 태그

    github
    코딩테스트
    bronze1
    bronze2
    Plugin
    c#
    백준
    Spring Boot
    spring
    minecraft
    codingtest
    Algorithm
    Windows
    Silver5
    Kotlin
    알고리즘
    java
    error
    갤럭시
    후기
  • 전체
    오늘
    어제
  • hELLO· Designed By정상우.v4.10.0
Kua
[DGS] GraphQLSchema: Factory method 'schema' threw exception; nested exception is java.lang.NoSuchMethodError 에러 해결
상단으로

티스토리툴바