Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

StatusLogger Caught javax.xml.parsers.ParserConfigurationException setting feature [duplicate]

Tags:

java

xml

After switching from Log4j to Log4j2 I started seeing errors like this in my output

ERROR StatusLogger Caught javax.xml.parsers.ParserConfigurationException setting feature http://xml.org/sax/features/external-general-entities to false on DocumentBuilderFactory oracle.xml.jaxp.JXDocumentBuilderFactory@49993335: javax.xml.parsers.ParserConfigurationException
 javax.xml.parsers.ParserConfigurationException
        at oracle.xml.jaxp.JXDocumentBuilderFactory.setFeature(JXDocumentBuilderFactory.java:218)
        at org.apache.logging.log4j.core.config.xml.XmlConfiguration.setFeature(XmlConfiguration.java:212)
        at org.apache.logging.log4j.core.config.xml.XmlConfiguration.disableDtdProcessing(XmlConfiguration.java:205)
        at org.apache.logging.log4j.core.config.xml.XmlConfiguration.newDocumentBuilder(XmlConfiguration.java:194)
        at org.apache.logging.log4j.core.config.xml.XmlConfiguration.<init>(XmlConfiguration.java:92)
        at org.apache.logging.log4j.core.config.xml.XmlConfigurationFactory.getConfiguration(XmlConfigurationFactory.java:46)
        at org.apache.logging.log4j.core.config.ConfigurationFactory$Factory.getConfiguration(ConfigurationFactory.java:454)
        at org.apache.logging.log4j.core.config.ConfigurationFactory$Factory.getConfiguration(ConfigurationFactory.java:386)
        at org.apache.logging.log4j.core.config.ConfigurationFactory.getConfiguration(ConfigurationFactory.java:261)
        at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:616)
        at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:637)
        at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:231)
        at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:153)
        at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45)
        at org.apache.logging.log4j.LogManager.getContext(LogManager.java:194)
        at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:581)
        at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:567)

These did not seem to affect logging output at all but the exception is annoying for a process that runs every couple of minutes. Looking for a solution to this.

like image 382
Mark Sholund Avatar asked Aug 31 '25 03:08

Mark Sholund


1 Answers

Answering my own question in the event that someone else runs into this problem.

The only solution I found (maybe it's not the right solution or there is a better one) is to add

-Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl

to my startup script and add xercesImpl-2.12.0.jar to my classpath (the version may not be important, that's just the one that I used).

like image 195
Mark Sholund Avatar answered Sep 02 '25 16:09

Mark Sholund