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

Log4j2 tries to SystemClassLoader when running on Google AppEngine

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.4
    • Component/s: Configurators
    • Labels:
      None
    • Environment:

      Google AppEngine

      Description

      Apache Struts recently switched to Log4j2 as a base logging layer and this broke deployments to Google AppEngine, below is the exception:

      Uncaught exception from servlet
      java.lang.ExceptionInInitializerError
      	at org.apache.logging.log4j.status.StatusLogger.<clinit>(StatusLogger.java:55)
      	at org.apache.logging.log4j.LogManager.<clinit>(LogManager.java:56)
      	at org.apache.struts2.tiles.StrutsTilesListener.<clinit>(StrutsTilesListener.java:50)
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
      	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      	at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
      	at java.lang.Class.newInstance(Class.java:375)
      	at org.mortbay.jetty.webapp.WebXmlConfiguration.newListenerInstance(WebXmlConfiguration.java:650)
      	at org.mortbay.jetty.webapp.WebXmlConfiguration.initListener(WebXmlConfiguration.java:631)
      	at org.mortbay.jetty.webapp.WebXmlConfiguration.initWebXmlElement(WebXmlConfiguration.java:368)
      	at org.mortbay.jetty.webapp.WebXmlConfiguration.initialize(WebXmlConfiguration.java:289)
      	at org.mortbay.jetty.webapp.WebXmlConfiguration.configure(WebXmlConfiguration.java:222)
      	at org.mortbay.jetty.webapp.WebXmlConfiguration.configureWebApp(WebXmlConfiguration.java:180)
      	at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1247)
      	at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
      	at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467)
      	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
      	at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.createHandler(AppVersionHandlerMap.java:199)
      	at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.getHandler(AppVersionHandlerMap.java:174)
      	at com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:134)
      	at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.run(JavaRuntime.java:527)
      	at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:437)
      	at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:444)
      	at com.google.tracing.CurrentContext.runInContext(CurrentContext.java:230)
      	at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:308)
      	at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:300)
      	at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:441)
      	at com.google.apphosting.runtime.ThreadGroupPool$PoolEntry.run(ThreadGroupPool.java:251)
      	at java.lang.Thread.run(Thread.java:745)
      Caused by: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "getClassLoader")
      	at java.security.AccessControlContext.checkPermission(AccessControlContext.java:382)
      	at java.security.AccessController.checkPermission(AccessController.java:572)
      	at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
      	at com.google.apphosting.runtime.security.CustomSecurityManager.checkPermission(CustomSecurityManager.java:56)
      	at java.lang.ClassLoader.checkClassLoaderPermission(ClassLoader.java:1606)
      	at java.lang.ClassLoader.getSystemClassLoader(ClassLoader.java:1525)
      	at org.apache.logging.log4j.util.LoaderUtil.findUrlResources(LoaderUtil.java:192)
      	at org.apache.logging.log4j.util.LoaderUtil.findResources(LoaderUtil.java:183)
      	at org.apache.logging.log4j.util.PropertiesUtil.<init>(PropertiesUtil.java:90)
      	at org.apache.logging.log4j.util.PropertiesUtil.<clinit>(PropertiesUtil.java:36)
      	... 30 more
      

      Looks like it tries to read a file from filesystem which is prohibited.

        Attachments

        1. scl.patch
          2 kB
          Lukasz Lenart

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                lukaszlenart Lukasz Lenart
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: