Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-3608

Could not initialize class org.apache.logging.log4j.util.PropertiesUtil when upgrade log4j2 2.17.1 to 2.18

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Invalid
    • 2.18.0
    • None
    • API
    • None
    • Java 11.

    Description

      When I try to upgrade log4j2 to 2.18 from 2.17.1, I run the testing, i get below error. 

      But it is fine when I switch back to 2.17. 

      The error is like this:

       

      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)
       
      

       

      When I debug it, I can see the error is from here:

       

      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)

       

      I did not figure out the root cause.

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            samuelma samuel ma
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: