java.lang.SecurityException: org.xml.sax.SAXNotRecognizedException: Feature: http://apache.org/xml/features/allow-java-encodings

tomcat

Solution

add the following properties to TOMCAT_HOME/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

source

Problem

I have a tomcat web application written in Struts. It runs well in Linux with `Tomcat 7` and `Java 7`. When I migrated it to Windows 10 under `Tomcat8.5` and `Java 8`, it throws a `SAXNOtREcognizedException` error and the application stops working: java.lang.SecurityException: org.xml.sax.SAXNotRecognizedException: Feature: http://apache.org/xml/features/allow-java-encodings These are the jar files included under the application WEB-INF/lib folder: ``` activation.jar BCEL.jar bsf.jar collections.jar commons-beanutils.jar commons-collections.jar commons-dbcp.jar commons-digester.jar commons-logging.jar commons-pool.jar commons-services.jar commons-validator.jar cos.jar crimson.jar DbConnectionBroker.jar java_cup.jar jaxp.jar jdbc2_0-stdext.jar jdom.jar jdom-jdk11.jar JLex.jar log4j-1.2.7.jar mailapi.jar mysql_comp.jar mysql.jar ojdbc7.jar regexp.jar runtime.jar smtp.jar struts.jar struts.jar--2 taglibs-request.jar xalan.jar xalansamples.jar xalanservlet.jar xercesImpl.jar xerces.jar xml-apis.jar xsltc.jar ``` They have the same jar files in both Linux and Windows. Someone suggested to add the bc4j-mbeans.jar, but I could not find where to download it. I tried to download the oc4j container, but there is no bc4j-mbeans.jar found.

Original source