samuel ma created LOG4J2-3608:
---------------------------------
Summary: Could not initialize class
org.apache.logging.log4j.util.PropertiesUtil when upgrade log4j2 2.17.1 to 2.18
Key: LOG4J2-3608
URL: https://issues.apache.org/jira/browse/LOG4J2-3608
Project: Log4j 2
Issue Type: Bug
Components: API
Affects Versions: 2.18.0
Environment: Java 11.
Reporter: samuel ma
When I try to upgrade log4j2 to 2.18 from 2.17.1, when I run the testing, i get
below error.
But it is fine when I switch back to 2.17.
The error is like this:
{code:java}
Could not initialize class org.apache.logging.log4j.util.PropertiesUtil
java.lang.NoClassDefFoundError: Could not initialize class
org.apache.logging.log4j.util.PropertiesUtil
at
org.apache.logging.log4j.status.StatusLogger.<clinit>(StatusLogger.java:78)
at org.apache.logging.log4j.LogManager.<clinit>(LogManager.java:61)
{code}
When I debug it, I can see the error is from here:
{code:java}
java.lang.IllegalStateException: stream has already been operated upon or closed
at
java.base/java.util.stream.AbstractPipeline.<init>(AbstractPipeline.java:203)
at
java.base/java.util.stream.ReferencePipeline.<init>(ReferencePipeline.java:94)
at
java.base/java.util.stream.ReferencePipeline$StatelessOp.<init>(ReferencePipeline.java:696)
at
java.base/java.util.stream.ReferencePipeline$2.<init>(ReferencePipeline.java:165)
at
java.base/java.util.stream.ReferencePipeline.filter(ReferencePipeline.java:164)
at org.apache.logging.log4j.util.PropertiesUtil$Environment.reload
at org.apache.logging.log4j.util.PropertiesUtil$Environment.<init>
at
org.apache.logging.log4j.util.PropertiesUtil.<init>(PropertiesUtil.java:88)
at
org.apache.logging.log4j.util.PropertiesUtil.<init>(PropertiesUtil.java:80)
at
org.apache.logging.log4j.util.PropertiesUtil.<clinit>(PropertiesUtil.java:56)
at org.apache.logging.log4j.util.Constants.<clinit>(Constants.java:30)
at
org.apache.logging.log4j.spi.AbstractLogger.createClassForProperty(AbstractLogger.java:207)
at
org.apache.logging.log4j.spi.AbstractLogger.<clinit>(AbstractLogger.java:95)
at org.apache.logging.log4j.LogManager.<clinit>(LogManager.java:61){code}
I did not figure out the root cause.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)