spring-cloud / spring-cloud-openfeign

Support for using OpenFeign in Spring Cloud apps
Apache License 2.0
1.22k stars 786 forks source link

Build a feign rpc, but find NoSuchMethod #816

Closed zoe610 closed 1 year ago

zoe610 commented 1 year ago

Describe the bug I built a toc-server, request from my main-server via feign client. These methods have same definition. When I debug, it seems feignClient is not null ,with name and domain name. Both the servers are running, but the resp throws an exception, says:org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoSuchMethodError: feign.Request.requestBody()Lfeign/Request$Body; and I can't find where the question is .

Sample it is the feign client definition:

    @GetMapping(value = "/get/grant/detail")
    ResponseVO<GrantDetailVO> getGrantDetail(@RequestParam("id") Long id);

it is the toc- server code

        ResponseVO<GrantDetailVO> vo = null;
        try {
            vo = userClient.getGrantDetail(id); //this line throws noSuchMethod ex
       ...
       }

these servers both use spring-boot-openfeign 2.2.1-RELEASE by the way, userClient is autoConfigurated by spring.factories, and it is notnull.

galaxy-sea commented 1 year ago

hello @zoe610 ,This may be caused by the incompatibility of the relevant dependencies of openFeign you use. reference java.lang.NoClassDefFoundError: feign/Request$Body in feign while adding support for multipart/form-data

OlgaMaciaszek commented 1 year ago

Hello @zoe610, 2.2.1-RELEASE has not been supported for a long time now. Please upgrade to a supported version (3.1.5 - with Boot 2.7.5 or 4.0.1 - with Boot 3.0.2 and verify. If the issue persists, please provide a minimal, complete, verifiable example that reproduces the issue.

spring-cloud-issues commented 1 year ago

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

spring-cloud-issues commented 1 year ago

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.