I'm using logback with groovy and get lots of warnings showing up when parsing xml. I am aware of the bug in JDK1.7_u45 that is causing this.
Warning: org.apache.xerces.parsers.SAXParser: Property 'http://javax.xml.XMLConstants/property/accessExternalDTD' is not recognized.
Warning: org.apache.xerces.parsers.SAXParser: Property 'http://www.oracle.com/xml/jaxp/properties/entityExpansionLimit' is not recognized.
Is there any way to turn off this log warnings from showing up in DEBUG? I tried writing a filter using Filter, but didn't help.
I also had this error in a project. As I understand it, newer versions of the JRE have the Xerces implementation built into it. More importantly, the JRE version properly supports the
accessExternalDTD
andentityExpansionLimit
properties.Because I had a downstream dependency that was including
xercesImpl.jar
in my war file, my solution was to just yank it using the code below in mybuild.gradle
and let the JRE implementation of xerces take over in the class path.This is a known bug in the JRE that reports this as an warning. See bug reports here and here
The issue happens only when you have xerces jar in your classpath, the xerces implementation does not recognize the property and throws an exception on org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.setProperty() which results in a warning log (to System.err) from the com.sun.org.apache.xalan.internal.xsltc.compiler.Parser.parse()
The easy (if possible) solution is remove xerces jar from your classpath.
Your log filter does not work since the error is never sent to slf4j. Which kind of suggests a convoluted way of fixing the issue - redirect System.err to slf4j and then use a logging filter on it.
Sample code to reproduce the issue (based on the issue report):
build.xsl
And maven dependency: