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

log4j2 fails when a whitespace is in the file path and Java security manager is used

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.13.0
    • 2.13.2
    • None
    • None
    • Windows 7/10, Java 8/11/13 with configured Java Security Manager

    Description

      SEVERE: Error configuring application listener of class [org.yurkom.navigator.web.servlet.StartupListener]
      java.security.AccessControlException: access denied ("java.io.FilePermission" "C:\My%20Space\apache-tomcat-9.0.30\webapps\navigator\WEB-INF\classes\log4j2.properties" "read")
              at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)
              at java.security.AccessController.checkPermission(AccessController.java:884)
              at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
              at java.lang.SecurityManager.checkRead(SecurityManager.java:888)
              at java.io.File.exists(File.java:814)
              at org.apache.logging.log4j.core.util.FileUtils.fileFromUri(FileUtils.java:88)
              at org.apache.logging.log4j.core.config.ConfigurationSource.fromResource(ConfigurationSource.java:360)
              at org.apache.logging.log4j.core.config.ConfigurationFactory$Factory.getConfiguration(ConfigurationFactory.java:527)
              at org.apache.logging.log4j.core.config.ConfigurationFactory$Factory.getConfiguration(ConfigurationFactory.java:456)
              at org.apache.logging.log4j.core.config.ConfigurationFactory.getConfiguration(ConfigurationFactory.java:318)
              at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:687)
              at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:708)
              at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:263)
              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.spi.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:138)
      

      policy file contains the following permissions:

      grant codeBase "file:${catalina.home}/webapps/navigator/-" {
              permission java.io.FilePermission "${catalina.home}/-", "read";
              permission java.io.FilePermission "${catalina.home}/", "read";
      };
      
      

      where catalina.home is "C:\My Space\apache-tomcat-9.0.30"

      It is related to LOG4J2-466

      Attachments

        Issue Links

          Activity

            People

              rgoers Ralph Goers
              yurkom Yury Molchan
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 50m
                  50m