I'm facing this exception when receiving an Xml and trying to parse it. The code responsible for that is well tested when running as an standalone application. However I'm now integrating it in Tomcat.
The stack trace is:
java.lang.IllegalStateException: org.xml.sax.SAXNotRecognizedException: http://javax.xml.XMLConstants/feature/secure-processing
at com.sun.xml.internal.bind.v2.util.XmlFactory.createParserFactory(XmlFactory.java:121)
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.getXMLReader(UnmarshallerImpl.java:139)
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:157)
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:204)
Digging around I found this, so maybe the solution is to change the options Tomcat sets.
So the question is:
Update
This happens when running it with Java 8, reverting to Java 7 works ok.
I had faced similar issue, this issue occurs when there is big difference in versions of xerces jar and xercesImpl jar. To solve this, I used xerces-2.9.0 and xercesImpl-2.9.1 and the issue gone.
I know this is an old question. But just updating it if it is of any help to others.. We had a similar issue recently while upgradig to java 8 with JBOSS 3.2.6. The cause of the issue was an old xercesImpl.jar. We upgraded to xercesImol-2.9.1.jar and the issue was resolved.
Well, this worked for me: Added below to my tomcat configuration arguments: -Djavax.xml.parsers.SAXParserFactory="com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With