Weblogic10.3.6部署解决CXF webService 调用报错: “Cannot create a secure XMLInputFactory”

时间:2022-09-16 19:35:10

一,解决步骤

1.添加jar包

stax2-api-3.1.4.jar

woodstox-core-asl-4.4.1.jar

2.编写监听器

 package com.neusoft.cxf.listener;

 import java.util.Properties;

 import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener; /**
* <p>Title: </p>
* <p>Description: weblogic容器部署CXF服务优先加载指定jar包</p>
* <p>Copyright:Copyright(c)2018</p>
* <p>Company:东软集团</p>
* @date 2018-04-25
* @author duanml
*/
public class CXFWeblogicListener implements ServletContextListener{ public CXFWeblogicListener() {
} @Override
public void contextDestroyed(ServletContextEvent arg0) { } @Override
public void contextInitialized(ServletContextEvent arg0) {
Properties props = System.getProperties();
props.setProperty("org.apache.cxf.stax.allowInsecureParser", "1");
} }

3.配置监听器

在web.xml下配置监听器

 <!--  weblogic容器部署CXF服务监听器 -->
<listener>
<listener-class>com.neusoft.cxf.listener.CXFWeblogicListener</listener-class>
</listener>