Reputation: 331
While instantiating a SOAP client, I get NullPointerException
@WebServiceClient(name = "QWEServiceManager", targetNamespace = "http://external.ws.services.abc.com/", wsdlLocation = "file:/C:/Users/XYZ/Desktop/77777/QWEServiceManagerService.wsdl")
public class QWEServiceManagerService extends Service
When I try to create an instance of the client to call the SOAP service
QWEServiceManagerService serv = new QWEServiceManagerService()
the above throws
Exception in thread "main" javax.xml.ws.WebServiceException: Unable to createEndpointReference Provider
at javax.xml.ws.spi.Provider.provider(Provider.java:160)
at javax.xml.ws.Service.<init>(Service.java:92)
at QWEServiceManagerService.<init>(QWEServiceManagerService .java:48)
at WsClient.main(WsClient.java:26)
Caused by: java.lang.NullPointerException
at javax.xml.ws.spi.Provider.provider(Provider.java:152)
... 3 more
Upvotes: 2
Views: 2772
Reputation: 331
The problem was with the fact that Java stopped providing default Provider Implementation above Java 6+.
It tries to find the Impl via following steps:
So, in simple, adding a dependency with implementation of provider solves the issue.
For me, adding jaxws-rt dependency solved the issue.
Note: I faced another dependency issue for which I did need to add another dependency to stax-ex to resolve all my dependency issues.
Upvotes: 3