首页 > 代码库 > cxf和jboss eap 6.2版本冲突

cxf和jboss eap 6.2版本冲突

升级jboss版本到jjboss-eap-6.2之后,启动项目时CXF出现异常。

在jboss-as-7.1.1.Final、apache-tomcat-7.0.37以及jboss-eap-6.1 下运行项目都正常,唯独jboss-eap-6.2下出问题。

异常如下:

10:30:28,053 INFO  [org.apache.cxf.service.factory.ReflectionServiceFactoryBean] (MSC service thread 1-8) Creating Service {http://cxf.mh.dev.ic.sy/}CXFServiceImplService from class sy.ic.dev.mh.cxf.CXFService
10:30:28,576 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-8) MSC000001: Failed to start service jboss.deployment.unit."cps.base.mh.web.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."cps.base.mh.web.war".INSTALL: JBAS018733: 处理 INSTALL 的 deployment "cps.base.mh.web.war" 阶段失败
	at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:127) [jboss-as-server-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
	at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
	at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) [rt.jar:1.6.0_43]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) [rt.jar:1.6.0_43]
	at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_43]
Caused by: javax.xml.ws.WebServiceException: org.apache.cxf.bus.extension.ExtensionException: Could not create object of extension class org.apache.cxf.wsdl11.WSDLManagerImpl.
	at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:371)
	at org.jboss.wsf.stack.cxf.deployment.EndpointImpl.doPublish(EndpointImpl.java:66)
	at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:251)
	at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:539)
	at org.jboss.wsf.stack.cxf.configuration.NonSpringBusHolder.configure(NonSpringBusHolder.java:117)
	at org.jboss.wsf.stack.cxf.deployment.aspect.BusDeploymentAspect.startDeploymentBus(BusDeploymentAspect.java:129)
	at org.jboss.wsf.stack.cxf.deployment.aspect.BusDeploymentAspect.start(BusDeploymentAspect.java:67)
	at org.jboss.as.webservices.deployers.AspectDeploymentProcessor.deploy(AspectDeploymentProcessor.java:74)
	at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:120) [jboss-as-server-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
	... 5 more
Caused by: org.apache.cxf.bus.extension.ExtensionException: Could not create object of extension class org.apache.cxf.wsdl11.WSDLManagerImpl.
	at org.apache.cxf.bus.extension.Extension.load(Extension.java:249)
	at org.apache.cxf.bus.extension.ExtensionManagerImpl.loadAndRegister(ExtensionManagerImpl.java:211)
	at org.apache.cxf.bus.extension.ExtensionManagerImpl.getBeansOfType(ExtensionManagerImpl.java:320)
	at org.apache.cxf.bus.CXFBusImpl.getExtension(CXFBusImpl.java:108)
	at org.apache.cxf.binding.soap.SoapBindingFactory.createSoapBinding(SoapBindingFactory.java:219)
	at org.apache.cxf.binding.soap.SoapBindingFactory.createBindingInfo(SoapBindingFactory.java:207)
	at org.apache.cxf.binding.AbstractBaseBindingFactory.createBindingInfo(AbstractBaseBindingFactory.java:83)
	at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createBindingInfo(AbstractWSDLBasedEndpointFactory.java:341)
	at org.apache.cxf.jaxws.JaxWsServerFactoryBean.createBindingInfo(JaxWsServerFactoryBean.java:182)
	at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpointInfo(AbstractWSDLBasedEndpointFactory.java:259)
	at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:144)
	at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:159)
	at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:211)
	at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:456)
	at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:334)
	... 13 more
Caused by: java.lang.ClassCastException: class org.apache.cxf.binding.corba.wsdl.PolicyType
	at java.lang.Class.asSubclass(Class.java:3027) [rt.jar:1.6.0_43]
	at org.apache.cxf.wsdl.JAXBExtensionHelper.addExtensions(JAXBExtensionHelper.java:91)
	at org.apache.cxf.wsdl11.WSDLManagerImpl.registerInitialXmlExtensions(WSDLManagerImpl.java:304)
	at org.apache.cxf.wsdl11.WSDLManagerImpl.registerInitialExtensions(WSDLManagerImpl.java:274)
	at org.apache.cxf.wsdl11.WSDLManagerImpl.<init>(WSDLManagerImpl.java:126)
	at org.apache.cxf.wsdl11.WSDLManagerImpl.<init>(WSDLManagerImpl.java:94)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [rt.jar:1.6.0_43]
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) [rt.jar:1.6.0_43]
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) [rt.jar:1.6.0_43]
	at java.lang.reflect.Constructor.newInstance(Constructor.java:513) [rt.jar:1.6.0_43]
	at org.apache.cxf.bus.extension.Extension.load(Extension.java:240)
	... 27 more


解决:jboss本身对soap有管理,因为已经确定问题就是由jboss eap 6.2引起的,所以到jboss配置文件里找到相关配置。

在D:\jboss-eap-6.2\standalone\configuration\standalone.xml中,找到以下代码注释掉。

		 <!--
        <subsystem xmlns="urn:jboss:domain:webservices:1.2">
            <modify-wsdl-address>true</modify-wsdl-address>
            <wsdl-host>${jboss.bind.address:127.0.0.1}</wsdl-host>
            <endpoint-config name="Standard-Endpoint-Config"/>
            <endpoint-config name="Recording-Endpoint-Config">
                <pre-handler-chain name="recording-handlers" protocol-bindings="##SOAP11_HTTP ##SOAP11_HTTP_MTOM ##SOAP12_HTTP ##SOAP12_HTTP_MTOM">
                    <handler name="RecordingHandler" class="org.jboss.ws.common.invocation.RecordingServerHandler"/>
                </pre-handler-chain>
            </endpoint-config>
            <client-config name="Standard-Client-Config"/>
        </subsystem>
		 -->

然后重启应用服务就OK了。


个人猜测这是jboss eap6.2的一个BUG,不过还是期待有高手有更好的解决方法。