![](/img/trans.png)
[英]The import javax.xml.parsers.ParserConfigurationException cannot be resolved
[英]How to fix javax.xml.parsers.ParserConfigurationException after switching to log4j2?
log4j2.xml
文件中描述的正确模式记录到正确的文件。 ERROR StatusLogger Caught javax.xml.parsers.ParserConfigurationException
运行项目时使用以下内容:
我正在使用的log4j2.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Properties>
<!-- Path to the log files -->
<Property name="log-path">C:/logs</Property>
</Properties>
<Appenders>
<!-- Logger that prints to the Console window -->
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout>
<pattern>%-6p%d{DATE} - %C{1}.%M:%L - %m%n</pattern>
</PatternLayout>
</Console>
<!-- Logger that prints to the log file specified in the fileName -->
<RollingFile name="LoggerFile" fileName="${log-path}/App.log" filePattern="${log-path}/App-%d{yyyy-MM-dd}-%i.log" immediateFlush="true" append="true">
<PatternLayout>
<pattern>%-6p%d{DATE} - %C{1}.%M:%L - %m%n</pattern>
</PatternLayout>
<!-- The maximum size of a log file -->
<Policies>
<SizeBasedTriggeringPolicy size="1 MB" />
</Policies>
<!-- Number of log files before starting to roll over -->
<DefaultRolloverStrategy max="10"/>
</RollingFile>
</Appenders>
<Loggers>
<Logger name="RollingFileLogger" level="DEBUG">
<AppenderRef ref="LoggerFile"/>
</Logger>
<Root level="DEBUG">
<AppenderRef ref="LoggerFile"/>
</Root>
</Loggers>
</Configuration>
任何想法是什么导致错误ERROR StatusLogger Caught javax.xml.parsers.ParserConfigurationException
吗?
可能是xml.jar
oracle.xdk_11.1.0\\xmlparserv2.jar
或xml.jar
吗?
我尝试了xmlparserv2.jar版本12.2,它修复了该错误。 要下载xmpparserv2.jar的12.2版本: https ://maven.oracle.com/com/oracle/jdbc/xmlparserv2/12.2.0.1/xmlparserv2-12.2.0.1.jar
我将xmlparser jar从版本11.1升级到版本12.2:xmlparserv2-12.2.0.1.jar。 我将其添加到项目中,并解决了该问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.