weblogic上部署CXFwebservice 错误!

发布到weblogic上,输入网址http://localhost:7002/CxfTest/ws/helloService?wsdl;能正常显示出xml

1、但是在客户端调用时

JaxWsProxyFactoryBean soapFactoryBean = new JaxWsProxyFactoryBean();
soapFactoryBean.setAddress("http://localhost:7002/CxfTest/ws/helloService");
soapFactoryBean.setServiceClass(IHelloService.class);
IHelloService helloService2 = (IHelloService)soapFactoryBean.create();
System.out.println("JaxWsProxyFactoryBean调用:"+helloService2.sayHello("Peter"));

 

就报错:javax.xml.ws.soap.SOAPFaultException: Cannot create a secure XMLInputFactory 

很多童鞋说缺少了两个jar包(stax2-api-3.1.x.jar 和 woodstox-core-asl-4.2.x.jar)

但是项目lib中已经包含了这2个包的;

在tomcat上运行正常,但在weblogic上就报该错误!

后经发现weblogic自带了很多jar包   当工程中的jar和weblogic自带jar版本不一致时 往往会出现错误。

为了解决在weblogic中jar包冲突的问题  在web-inf下创建一个weblogic.xml

<?xml version="1.0"?>
<weblogic-web-app
xmlns="http://www.bea.com/ns/weblogic/weblogic-web-app"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-web-app http://www.bea.com/ns/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd">
<container-descriptor>
<!-- 预先加载项目中的jar包 -->
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>
</weblogic-web-app>