NoClassDefFoundError when I call RestTemplate.exchange() on a fake api

Viewed 72

I upgraded jackson-databind lib to 2.10.0.pr3 to overcome some Veracode vulnerabilities and now one of my tests is failing on calling RestTemplate.exchange() on a bad api.

The RequestEntity has a url of http://localhost:9999/fake/api and HttpMethod = POST. I have a custom dto for a response type.

getRestTemplate().exchange(requestEntity, MyResponseDto.class);

My test initially expected a ResourceAccessException, and this worked ok up to 2.9.10.

After upgrade, when I debug into the library code into org.springframework.web.client.RestTemplate.doExecute() the call on line 733, requestCallback.doWithRequest(request) throws a NoClassDefFoundError and I cannot find any implementation of that method.

Is there some new setup required? Do I need to implement the RequestCallback in my code and write a concrete implementation of doExecute? I tried this with a simple logging, but it did not break there, and I think that would be a regression of the library if I needed to do this.

0 Answers
Related