Weblogic10.3.6部署解决CXF webService 调用报错: “Cannot create a secure XMLInputFactory”
一,解决步骤
1.添加jar包
stax2-api-3.1.4.jar
woodstox-core-asl-4.4.1.jar
2.编写监听器
1 package com.neusoft.cxf.listener; 2 3 import java.util.Properties; 4 5 import javax.servlet.ServletContextEvent; 6 import javax.servlet.ServletContextListener; 7 8 /** 9 * <p>Title: </p> 10 * <p>Description: weblogic容器部署CXF服务优先加载指定jar包</p> 11 * <p>Copyright:Copyright(c)2018</p> 12 * <p>Company:东软集团</p> 13 * @date 2018-04-25 14 * @author duanml 15 */ 16 public class CXFWeblogicListener implements ServletContextListener{ 17 18 19 public CXFWeblogicListener() { 20 } 21 22 @Override 23 public void contextDestroyed(ServletContextEvent arg0) { 24 25 } 26 27 @Override 28 public void contextInitialized(ServletContextEvent arg0) { 29 Properties props = System.getProperties(); 30 props.setProperty("org.apache.cxf.stax.allowInsecureParser", "1"); 31 } 32 33 }
3.配置监听器
在web.xml下配置监听器
1 <!-- weblogic容器部署CXF服务监听器 --> 2 <listener> 3 <listener-class>com.neusoft.cxf.listener.CXFWeblogicListener</listener-class> 4 </listener>