问题描述
我正在使用JBoss 5.1.0.GA(用于JDK6)和jaxws 2.2.6。
当我调用webservice时,我得到以下异常:
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不是
实例化:
的java.lang.ClassCastException java.util.ServiceLoader.fail(ServiceLoader.java:207)at
java.util.ServiceLoader.access $ 100(ServiceLoader.java: 164)
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.java:92)
[...]
... 3更多引起:
java.lang的java.lang.ClassCastException。 Class.cast(Class.java:2990)at
java.util.ServiceLoader $ LazyIterator.next(ServiceLoader.java:345)
... 14 more
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
我还尝试从3.1.2.GA将jbossws更新到3.4.0版,没有任何改变。
我已经阅读了很多关于检查lib / jars of JBoss中的jar的建议,所以这是内容:
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
我是还将switch -verbose:class添加到JVM:
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!/]
并且该类扩展 javax.xml.ws.spi.Provider
(http://bit.ly/LK9bNE)
and that class extends javax.xml.ws.spi.Provider
(http://bit.ly/LK9bNE)
有人可以帮我解决这里发生的事情吗?
Can someone help me what's going on here?
编辑1
好的,所以我看到ClassCastException来自:ServiceLoader.java line 345
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());
调用service.cast时,此
是 javax.xml.ws.spi.Provider
并且要转换的arg是 org.jboss.ws.core.jaxws.spi.ProviderImpl
。
我仍然无法理解这个问题。
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.
推荐答案
最后,我设法解决了我的问题:我将 jaxws-rt.jar
放入 $ JBOSS_HOME / lib / endorsed
。
Finally, I've managed to solve my problem: I put jaxws-rt.jar
in $JBOSS_HOME/lib/endorsed
.
编辑
我在JBoss 5.1 EAP上遇到了同样的问题,为了解决这个问题,步骤略有不同:
in $ JBOSS_HOME / lib / endorsed
我删除了旧的jaxb-api.jar,然后复制了
EDIT
I had the same problem on JBoss 5.1 EAP, and to solve it, the steps are a little different:in $JBOSS_HOME/lib/endorsed
I removed the old jaxb-api.jar, then copied
- jaxb-api.jar
- jaxb-impl.jar
- jaxws-api.jar
- jaxws- rt.jar
- jaxb-api.jar
- jaxb-impl.jar
- jaxws-api.jar
- jaxws-rt.jar
来自最新的jaxws-ri软件包,最终有效。
from the latest jaxws-ri package, and eventually it worked.
这篇关于JBoss上的JaxWS ClassCastException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!