java.lang.SecurityException: AuthConfigFactory error:

java.lang.reflect.InvocationTargetException Caused by: java.lang.SecurityException: org.xml.sax.SAXNotRecognizedException: Feature ‘http://apache.org/xml/features/allow-java-encodings’ not recognize

最近在做老项目的安全升级时,将jdk版本由1.7升级为1.8,并将tomcat由Tomcat7升级为Tomcat8.5.63版本,升级后项目启动时没有报错,但是在访问时报500错误,然而Tomcat小窗口也没有报错,打开日志发现抛出java.lang.reflect.InvocationTargetException
Caused by: java.lang.SecurityException: org.xml.sax.SAXNotRecognizedException: Feature ‘http://apache.org/xml/features/allow-java-encodings’ not recognized错误,刚开始以为是架包冲突,经过排查后并不是。(如果大家遇上以上情况可以试试我这个方法)好了,废话不多说了,直接上图。
报错图例:
前端请求页面报错

Tomcat报错日志:
在这里插入图片描述

解决方法:在Tomcat包下conf下的catalina.properties文件中加入以下配置就可以了

javax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
javax.xml.transform.TransformerFactory=com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl
javax.xml.parsers.SAXParserFactory=com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl
javax.xml.datatype.DatatypeFactory=com.sun.org.apache.xerces.internal.jaxp.datatype.DatatypeFactoryImpl

ps:这是本人遇见的一种情况找到的解决方法,如果大家也遇见过,欢迎一起讨论。

猜你喜欢

转载自blog.csdn.net/Acompanys/article/details/125274355