Glassfish v3.0.1. Windows. Netbeans 6.8
Create a simple web service in Netbeans. Deployed to Glassfish. Built a web service client based on wsdl in Netbeans 6.8. There is no problem with the client running outside of glassfish. When it is called from an ejb or servlet loaded in the glassfish, the following exception occurred:
SEVERE: java.util.ServiceConfigurationError: javax.xml.ws.spi.Provider:
Provider com.sun.xml.ws.spi.ProviderImpl could not be instantiated:
java.lang.ClassCastException
at java.util.ServiceLoader.fail(ServiceLoader.java:207)
at java.util.ServiceLoader.access$100(ServiceLoader.java:164)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:353)
at java.util.ServiceLoader$1.next(ServiceLoader.java:421)
at javax.xml.ws.spi.Provider.getProviderUsingServiceLoader
(Provider.java:146)
at javax.xml.ws.spi.Provider.provider(Provider.java:106)
at javax.xml.ws.Service.<init>(Service.java:57)
at com.airliquide.soapws.client.dsslookup.DssLookupService.<init>
(DssLookupService.java:58)
....
There are a few issues posted over the time which are quite similar. But I am still not sure how to get around this. Please help.
THanks.
[Message sent by forum member 'hyijun37013']
http://forums.java.net/jive/thread.jspa?messageID=483947
No taker on this one. Let me make it easier to break it down to simpler questions.
1) Has anyone used Netbeans 6.8 to build a web service JAXWS style client stub via the web service wsdl (new -> web service client -> choose 'WSDL URL')?
2) If yes to 1). Have you used the client stub to comsume the web service from an EJB or servlet in a web app deployed on Glassfish v3.0.1?
3) if the web service is not local on the same glassfish service, does it work?
4) If still yes, is the following the right way to use the client stub assume that the web service class is com.wstest.WSTest and the web service at http://anyserver:8080/SOAPWSEE6/WSTestService?wsdl
URL baseUrl = WSTestService.class.getResource(".");
WSTestService service = new WSTestService(new URL(baseUrl, " http://anyserver:8080/SOAPWSEE6/WSTestService?wsdl "), new QName(" http://wstest.com/", "WSTestService"));
port = service.getWSTestPort();
Thanks.
[Message sent by forum member 'hyijun37013']
http://forums.java.net/jive/thread.jspa?messageID=484128
Andrew Humphries Sun, 16 Sep 2012 00:24:58 -0700
I think the problem is that when calling a WS client from inside JEE6/5 the code you need to write is different from the code Netbeans provides when selecting New -> 'web service client', which is the code to use for calling from a JSE app.
When calling from in JEE you need to use the annotations, as per this page.
http://victor-ichim.blogspot.com.au/2012/02/dynamic-wsdl-location-with-jax-ws.html?showComment=1347779697048#c8593097240957982344
I realize this is late advice, but I've just come across the same problem as you and then realised the solution. Hopefully ;) - I'll be testing this tomorrow... Cheers