tomcat升级为8后,webservice接口调用报错,具体异常信息如下:“Cannot create a secure XMLInputFactory,you should either add woodstox or set org.apache.cxf.stax.allowInsecureParser system property to true if an unsafe mode is acceptable.”
分析具体的原因为:woodstox*.jar有冲突导致,cxf3.*.*以后的jar需要删除掉woodstox低版本的jar 如wstx-asl.3.2.7。
但是solr jar对wstx-asl.3.2.7 jar又有依赖,具体见图一。
两种解决方法:
1、升级solr jar版本。
2、设置org.apache.cxf.stax.allowInsecureParser 属性值为true,来暂时接受这种不安全的方式。tomcat/bin/setenv.sh文件的JAVA_OPTS值后面需要追加“-Dorg.apache.cxf.stax.allowInsecureParser=1”