繁体   English   中英

StatusLogger 捕获 javax.xml.parsers.ParserConfigurationException 设置功能

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

从 Log4j 切换到 Log4j2 后,我开始在输出中看到这样的错误

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)

这些似乎根本不影响日志输出,但是对于每隔几分钟运行一次的进程来说,异常很烦人。 正在寻找解决方案。

如果其他人遇到此问题,请回答我自己的问题。

我找到的唯一解决方案(也许这不是正确的解决方案,或者有更好的解决方案)是添加

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

到我的启动脚本并将xercesImpl-2.12.0.jar添加到我的类路径(版本可能并不重要,这只是我使用的那个)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM