I'm using JBoss 5.1.0.GA (for JDK6), and jaxws 2.2.6. When I invoke the webservice, I get the following exception:
java.util.ServiceConfigurationError: javax.xml.ws.spi.Provider: Provider org.jboss.ws.core.jaxws.spi.ProviderImpl could not be instantiated: java.lang.ClassCastException at org.jboss.resource.work.WorkWrapper.completed(WorkWrapper.java:283)
at org.jboss.util.threadpool.BasicTaskWrapper.taskCompleted(BasicTaskWrapper.java:367) at org.jboss.util.threadpool.BasicTaskWrapper.run(BasicTaskWrapper.java:268) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:680)Caused by: java.util.ServiceConfigurationError: javax.xml.ws.spi.Provider: Provider org.jboss.ws.core.jaxws.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:180) at javax.xml.ws.spi.Provider.provider(Provider.java:140) at javax.xml.ws.Service.(Service.java:92)
[...]
... 3 more Caused by: java.lang.ClassCastException at java.lang.Class.cast(Class.java:2990) at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:345)
... 14 more
I also tried to update jbossws to version 3.4.0 from 3.1.2.GA, nothing changed. I've read a lot of suggestions related to checking jars in lib/endorsed of JBoss, so this is the content:
activation.jar jaxb-api.jar jaxws-api.jar jbossws-native-factories.jar resolver.jar serializer.jar stax-api.jar xalan.jar xercesImpl.jar
I've also added the switch -verbose:class to the JVM:
[Loaded org.jboss.ws.core.jaxws.spi.ProviderImpl from jar:file:/Users/carlo/jboss-5.1.0.GA/common/lib/jbossws-native-core.jar!/]
and that class extends javax.xml.ws.spi.Provider
(http://bit.ly/LK9bNE)
Can someone help me what's going on here?
EDIT 1
Ok, so I see that the ClassCastException is raised from: ServiceLoader.java line 345
S p = service.cast(Class.forName(cn, true, loader).newInstance());
when service.cast is called, this
is javax.xml.ws.spi.Provider
and the arg to cast is org.jboss.ws.core.jaxws.spi.ProviderImpl
. I still fail to understand the problem though.