playframework / playframework/play-soap
NullPointerException when using CompletionStage fetched by generated proxy
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 37
- Forks
- 24
- Avg merge
- 4h 7m
- Merged PRs (30d)
- 2
Description
New Play application created through sbt running with the following versions:
- play-soap v. 1.1.3
- Play v. 2.6.5
- Scala v. 2.11.11
My Java-classes are generated from the following internal service:
WsdlKeys.wsdlUrls in Compile += url("http://172.x.x.x/SOAP/PortalService.svc?wsdl")
Below is a simple index method in my controller. I've deliberately avoided the return type CompletionStage<Result> on the method for simplicity's sake:
public Result index() {
ObjectFactory factory = new ObjectFactory();
PortalUserDTO portalUserDTO = new PortalUserDTO();
portalUserDTO.setUsername(factory.createPortalUserDTOUsername("test"));
portalUserDTO.setFullName(factory.createPortalUserDTOFullName("Test User"));
ICitizenEndpoint client = portalService.getPortalServiceCitizenEndpoint();
CompletionStage<PortalCitizenDTO> citizen = client.fetchCitizen(10, portalUserDTO);
// Thread.sleep(500);
citizen.thenApply(x -> x);
return ok("Everything is fine.");
}
The NullPointerException appears to be sporadic (roughly 20% of the time), and can be avoided by sleeping the running thread. Below is a stack trace of when the exception is thrown:
Exception in thread "default-workqueue-1" java.lang.NullPointerException
at org.apache.cxf.endpoint.ClientImpl$1.onMessage(ClientImpl.java:505)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream$1.run(HTTPConduit.java:1185)
at org.apache.cxf.workqueue.AutomaticWorkQueueImpl$3.run(AutomaticWorkQueueImpl.java:428)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.cxf.workqueue.AutomaticWorkQueueImpl$AWQThreadFactory$1.run(AutomaticWorkQueueImpl.java:353)
at java.lang.Thread.run(Thread.java:748)
Wireshark shows that the endpoint does provide it with data.
I'm unsure if this behaviour was introduced when you moved from promises to CompletionStages, but I imagine that it is likely. This does prevent me from using the plugin.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the sporadic failure with the generated ICitizenEndpoint proxy and client.fetchCitizen call described in the controller example. Trace the asynchronous path through org.apache.cxf.endpoint.ClientImpl.java:505 and HTTPConduit.java:1185, using the provided stack trace and Wireshark observation as checkpoints. Done means the proxy completes reliably without the NullPointerException, without relying on Thread.sleep.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, scala
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100