• 카테고리

    질문 & 답변
  • 세부 분야

    백엔드

  • 해결 여부

    미해결

feign client 실행 오류

21.06.29 11:45 작성 조회수 1.43k

0

안녕하세요 user-service 실행 시 feign client 관련 에러가 나는 것 같아 질문 드립니다.  

먼저 강의에서 나온 대로 디펜던시 추가 시  

WARNING: An illegal reflective access operation has occurred

WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils (file:/C:/Users/SAMSUNG/.m2/repository/org/springframework/spring-core/5.3.7/spring-core-5.3.7.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)

WARNING: Please consider reporting this to the maintainers of org.springframework.cglib.core.ReflectUtils

WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations

WARNING: All illegal access operations will be denied in a future release

***************************
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:

    org.springframework.cloud.sleuth.instrument.web.client.feign.TraceRetryableFeignBlockingLoadBalancerClient.<init>(TraceRetryableFeignBlockingLoadBalancerClient.java:60)

The following method did not exist:

    org.springframework.cloud.openfeign.loadbalancer.RetryableFeignBlockingLoadBalancerClient.<init>(Lfeign/Client;Lorg/springframework/cloud/loadbalancer/blocking/client/BlockingLoadBalancerClient;Lorg/springframework/cloud/client/loadbalancer/LoadBalancedRetryFactory;)V

The method's class, org.springframework.cloud.openfeign.loadbalancer.RetryableFeignBlockingLoadBalancerClient, is available from the following locations:

    jar:file:/C:/Users/SAMSUNG/.m2/repository/org/springframework/cloud/spring-cloud-openfeign-core/3.0.2/spring-cloud-openfeign-core-3.0.2.jar!/org/springframework/cloud/openfeign/loadbalancer/RetryableFeignBlockingLoadBalancerClient.class

The class hierarchy was loaded from the following locations:

    org.springframework.cloud.openfeign.loadbalancer.RetryableFeignBlockingLoadBalancerClient: file:/C:/Users/SAMSUNG/.m2/repository/org/springframework/cloud/spring-cloud-openfeign-core/3.0.2/spring-cloud-openfeign-core-3.0.2.jar


Action:

Correct the classpath of your application so that it contains a single, compatible version of org.springframework.cloud.openfeign.loadbalancer.RetryableFeignBlockingLoadBalancerClient


Process finished with exit code 0

위와 같은 오류가 호출 됩니다. 그 후 feign client의 버전을 3.0 이하로 내려서 실행하였더니 feign client 가 빈으로 생성시 오류가 생기 며 

No Feign Client for loadBalancing defined. Did you forget to include spring-cloud-starter-netflix-ribbon or spring-cloud-starter-loadbalancer?

해당 오류가 호출 됩니다 

답변 부탁드립니다.

답변 2

·

답변을 작성해보세요.

0

문태환님의 프로필

문태환

질문자

2021.07.01

질문 드린 오류 관련해서 검색하여 보니 sleuth 와 함께 사용하여 발생 하는 오류라는 글을 보고

sleuth 디펜던시를 막고 실행   하였더니 정상적으로 실행이 되었습니다. 자세한 내용은 안나와 있어서 모르겠내요 ...  아래는 pom.xml 입니다.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.4.6</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.example</groupId>
    <artifactId>user-service</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>user-service</name>
    <description>Demo project for Spring Boot</description>
    <properties>
        <java.version>11</java.version>
        <spring-cloud.version>2020.0.2</spring-cloud.version>
        <spring.version>5.3.7</spring.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <!-- https://mvnrepository.com/artifact/com.h2database/h2 -->
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <version>1.3.176</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>

        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt</artifactId>
            <version>0.9.1</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>

        <dependency>
            <groupId>org.modelmapper</groupId>
            <artifactId>modelmapper</artifactId>
            <version>2.3.8</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-config</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-bootstrap</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>

        <!--spring bus 를 사용하기 위한 디펜던시-->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-bus-amqp</artifactId>
        </dependency>
        <!--spring bus 를 사용하기 위한 디펜던시-->

    <!-- Feign Client-->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-openfeign</artifactId>
        </dependency>
    <!-- Feign Client-->

        <!-- Circuit Breaker resilience4j -->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-circuitbreaker-resilience4j</artifactId>
        </dependency>
        <!-- Circuit Breaker resilience4j  -->

        <!-- zipKin / sleuth -->
<!--        <dependency>-->
<!--            <groupId>org.springframework.cloud</groupId>-->
<!--            <artifactId>spring-cloud-starter-sleuth</artifactId>-->
<!--            <version>2.2.8.RELEASE</version>-->
<!--        </dependency>-->

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-zipkin</artifactId>
            <version>2.2.8.RELEASE</version>
        </dependency>
        <!-- zipKin / sleuth -->

         <!--micrometer-->
        <dependency>
            <groupId>io.micrometer</groupId>
            <artifactId>micrometer-registry-prometheus</artifactId>
        </dependency>
         <!--micrometer-->


    </dependencies>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${spring-cloud.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                        </exclude>
                    </excludes>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

0

안녕하세요, 이도원입니다. 

작업하신 Feign Client의 버전이 3.0.2 라고 하셨는데, 추가하신 pom.xml 파일을 공유해 주실 수 있을까요? 다른쪽 라이브러리와의 문제일 수 있을 것 같습니다. 제가 사용하는 Fieng Client의 Dependency 부분은 다음과 같습니다. 

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>

참고로, 3.0 이하 버전을 사용할 시 발생하는 오류는 버전 다른 Netflix OSS 라이브러리들을 사용하고 있어서 추천드리지 않습니다. 

감사합니다.