当我尝试从资源适配器内部调用基于WSDL的Web服务时,我得到以下异常:
SEVERE [org.apache.cxf.BusFactory] (JmsMessageDispatcher#2) Failed to determine BusFactory implementation class name.: java.lang.ClassCastException: class org.apache.cxf.bus.spring.SpringBusFactory
at java.lang.Class.asSubclass(Class.java:3126) [rt.jar:1.7.0_45]
at org.apache.cxf.BusFactory.getBusFactoryClass(BusFactory.java:333) [cxf-api-2.5.9.jar:2.5.9]
at org.apache.cxf.BusFactory.newInstance(BusFactory.java:260) [cxf-api-2.5.9.jar:2.5.9]
at org.apache.cxf.BusFactory.newInstance(BusFactory.java:247) [cxf-api-2.5.9.jar:2.5.9]
at org.apache.cxf.BusFactory.getDefaultBus(BusFactory.java:99) [cxf-api-2.5.9.jar:2.5.9]
at org.apache.cxf.BusFactory.createThreadBus(BusFactory.java:193) [cxf-api-2.5.9.jar:2.5.9]
at org.apache.cxf.BusFactory.getThreadDefaultBus(BusFactory.java:182) [cxf-api-2.5.9.jar:2.5.9]
at org.apache.cxf.BusFactory.getThreadDefaultBus(BusFactory.java:166) [cxf-api-2.5.9.jar:2.5.9]
at org.apache.cxf.frontend.ClientProxyFactoryBean.configureObject(ClientProxyFactoryBean.java:99) [cxf-rt-frontend-simple-2.5.9.jar:2.5.9]
at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:131) [cxf-rt-frontend-simple-2.5.9.jar:2.5.9]
at org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:155) [cxf-rt-frontend-jaxws-2.5.9.jar:2.5.9]
在部署所述资源适配器期间,我收到此警告:
WARN [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015893: Encountered invalid class name 'org.springframework.context.ApplicationContext,org.springframework.beans.BeansException' for service type 'org.apache.cxf.bus.factory'
我想这就像他们说:警告迟早会成为错误;)
this问题的答案没有用,因为我已经将以下依赖项添加到我的pom.xml中了:
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-api</artifactId>
<version>2.5.9</version>
</dependency>
资源适配器部署为JCA连接器(.rar)。
感谢您的帮助!
答案 0 :(得分:1)
不要使用资源适配器提供Spring和CXF。将它们包含为模块依赖项。
在您的RA项目中:
META-INF / JBoss的部署-structure.xml
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<deployment>
<dependencies>
<module name="org.jboss.ws.cxf.jbossws-cxf-client" services="import" />
<module name="org.apache.cxf"> <!-- .impl removed -->
<imports>
<include path="META-INF" />
<include path="META-INF/cxf" />
</imports>
</module>
<module name="org.springframework.spring">
<imports>
<include path="META-INF" />
</imports>
</module>
</dependencies>
</deployment>
</jboss-deployment-structure>
由于spring不是JBoss的一部分,因此您必须将其部署为新模块。
module.xml
<?xml version="1.0" ?>
<module xmlns="urn:jboss:module:1.1" name="org.springframework.spring">
<resources>
<resource-root path="spring-aop-3.2.4.RELEASE.jar" />
<resource-root path="spring-beans-3.2.4.RELEASE.jar" />
<resource-root path="spring-context-3.2.4.RELEASE.jar" />
<resource-root path="spring-core-3.2.4.RELEASE.jar" />
<resource-root path="spring-expression-3.2.4.RELEASE.jar" />
<resource-root path="spring-web-3.2.4.RELEASE.jar" />
</resources>
<dependencies>
<module name="javax.api" />
<module name="javax.servlet.api" />
<module name="javax.transaction.api" />
<module name="org.apache.commons.logging" />
</dependencies>
</module>
我不确定这是否是JBoss内部的类加载错误。