0

I have an integration test that ends up making two API calls to the same service. One is a GET call, and the other is a PUT. When it calls the GET, it works just fine, but when it calls the PUT, it doesn't find a matching request and throws an exception.

The userService in the below example is a WireMock Server

Here is my stubbing

private void stub() {
    userService.stubFor(
            get(urlPathEqualTo("/api/v1/users/" + userId))
                    .willReturn(
                            aResponse()
                                    .withStatus(200)
                                    .withHeader("Content-Type", "application/json")
                                    .withHeader(HttpHeaders.CONNECTION, "close")
                                    .withBody(
                                            "{"
                                                    + "\"id\": \""
                                                    + userId
                                                    + "\","
                                                    + "\"name\": \""
                                                    + userName
                                                    + "\""
                                                    + "}")));
    userService.stubFor(
            put(urlPathEqualTo("/api/v1/users"))
                    .willReturn(
                            aResponse()
                                    .withStatus(200)
                                    .withHeader("Content-Type", "application/json")
                                    .withHeader(HttpHeaders.CONNECTION, "close")));
}

The exception that ends up being thrown from the PUT call is

Caused by: org.springframework.retry.RetryException: Could not recover; nested exception is java.lang.AbstractMethodError: Receiver class org.springframework.cloud.netflix.ribbon.RibbonLoadBalancerClient does not define or inherit an implementation of the resolved method 'abstract org.springframework.cloud.client.ServiceInstance choose(java.lang.String, org.springframework.cloud.client.loadbalancer.Request)' of interface org.springframework.cloud.client.loadbalancer.ServiceInstanceChooser.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Toast
  • 111
  • 1
  • 9
  • https://stackoverflow.com/questions/68561504/open-feignclient-integration-with-netflix-ribbon-not-working-in-springboot – dekkard May 17 '22 at 08:27
  • I never heard about OpenFeign before, and the person in that post did receive the same error I did, but it doesn't seem relevant to my issue. Probably both have the same underlying issue, but there could be many reasons why this exception would be thrown. I'm trying to figure out why my specific use case is causing this exception – Toast May 17 '22 at 12:51

0 Answers0