question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

spring-retry with MockWebServiceServer error: 'webServiceTemplate' must not be null

See original GitHub issue

I’m using spring-boot 1.5.7.RELEASE and I’m having trouble when I have a mocked WebServiceGatewaySupport which has @Retryable annotations in the subclass of that class. When I call Mockito.verify() I get an UnfinishedVerificationException exception.

I find a workaround like #6828 and #5837

if (client instanceof Advised) {
	client = (MySubClassOfWebServiceGatewaySupport) ((Advised) client).getTargetSource().getTarget();
}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
wilkinsonacommented, Feb 9, 2018

Thanks. This isn’t a Spring Boot problem. It’s a problem with Spring Retry proxying QuoteClient due to its @Retryable method and MockWebServiceServer.createServer being unable to correctly consume that proxy. You can avoid the problem by unwrapping the proxy before passing it into createServer:

@Before
public void before() {
    mockServer = MockWebServiceServer.createServer((QuoteClient)AopTestUtils.getUltimateTargetObject(quoteClient));
}
0reactions
mhewedycommented, Feb 8, 2018

Demo spring boot app to reproduce the issue demo.zip

Read more comments on GitHub >

github_iconTop Results From Across the Web

Test Web Service Client with spring MockWebServiceServer
I believe the error has something to do with the WebServiceTemplate I autowired into my WS client as below. Since I am using...
Read more >
Guide to Spring Retry - Baeldung
A quick and practical guide to implementing retry logic with Spring Retry.
Read more >
MockWebServiceServer xref - Spring
WebServiceTemplate ; 22 import org.springframework.ws.client.core.support. ... notNull(webServiceTemplate, "'webServiceTemplate' must not be null"); 110 111 ...
Read more >
Spring Retry — How to Handle Failures - DZone
Learn various way to handle failures in microservices software architecture with Spring Retry in this tutorial for Java microservices ...
Read more >
Client Integration Testing with MockWebServiceServer
Instead, I prefer to have WebServiceTemplate injected into my client class. ... First, we need the following Spring Web Services dependency: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found