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

ServiceConfigurationError in Tomcat when Log4j is used as the logging implementation

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.9.1
    • Fix Version/s: 2.10.0
    • Component/s: API
    • Labels:
      None

      Description

      When Log4j is used as the Tomcat logging implementation using the log4j-appserver Handler applications using Log4j will fail to start trying to load a Log4jProvider they cannot access. The following will appear in the startup log.

      2017-09-23 17:29:43,223 [localhost-startStop-1] ERROR o.a.c.c.ContainerBase.addChildInternal:755 - ContainerBase.addChild: start:
      org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/AuditCatalog]]
              at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167) ~[catalina.jar:8.5.20]
              at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752) [catalina.jar:8.5.20]
              at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728) [catalina.jar:8.5.20]
              at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734) [catalina.jar:8.5.20]
              at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:988) [catalina.jar:8.5.20]
              at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1860) [catalina.jar:8.5.20]
              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:514) [?:?]
              at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) [?:?]
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) [?:?]
              at java.lang.Thread.run(Thread.java:844) [?:?]
      Caused by: java.util.ServiceConfigurationError: org.apache.logging.log4j.spi.Provider: org.apache.logging.log4j.core.impl.Log4jProvider not a subtype
              at java.util.ServiceLoader.fail(ServiceLoader.java:588) ~[?:?]
              at java.util.ServiceLoader.access$200(ServiceLoader.java:390) ~[?:?]
              at java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1231) ~[?:?]
              at java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1259) ~[?:?]
              at java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1294) ~[?:?]
              at java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1379) ~[?:?]
              at org.apache.logging.log4j.util.ProviderUtil.loadProviders(ProviderUtil.java:101) ~[log4j-api-2.9.2-SNAPSHOT.jar:2.9.2-SNAPSHOT]
              at org.apache.logging.log4j.util.ProviderUtil.<init>(ProviderUtil.java:67) ~[log4j-api-2.9.2-SNAPSHOT.jar:2.9.2-SNAPSHOT]
              at org.apache.logging.log4j.util.ProviderUtil.lazyInit(ProviderUtil.java:142) ~[log4j-api-2.9.2-SNAPSHOT.jar:2.9.2-SNAPSHOT]
              at org.apache.logging.log4j.util.ProviderUtil.hasProviders(ProviderUtil.java:126) ~[log4j-api-2.9.2-SNAPSHOT.jar:2.9.2-SNAPSHOT]
              at org.apache.logging.log4j.spi.ThreadContextMapFactory.createThreadContextMap(ThreadContextMapFactory.java:73) ~[log4j-api-2.9.2-SNAPSHOT.jar:2.9.2-SNAPSHOT]
              at org.apache.logging.log4j.ThreadContext.init(ThreadContext.java:224) ~[log4j-api-2.9.2-SNAPSHOT.jar:2.9.2-SNAPSHOT]
              at org.apache.logging.log4j.ThreadContext.<clinit>(ThreadContext.java:203) ~[log4j-api-2.9.2-SNAPSHOT.jar:2.9.2-SNAPSHOT]
              at org.apache.logging.log4j.core.impl.ContextDataInjectorFactory.createDefaultInjector(ContextDataInjectorFactory.java:83) ~[log4j-core-2.9.1.jar:2.9.1]
              at org.apache.logging.log4j.core.impl.ContextDataInjectorFactory.createInjector(ContextDataInjectorFactory.java:67) ~[log4j-core-2.9.1.jar:2.9.1]
              at org.apache.logging.log4j.core.lookup.ContextMapLookup.<init>(ContextMapLookup.java:34) ~[log4j-core-2.9.1.jar:2.9.1]
              at org.apache.logging.log4j.core.lookup.Interpolator.<init>(Interpolator.java:117) ~[log4j-core-2.9.1.jar:2.9.1]
              at org.apache.logging.log4j.web.Log4jWebInitializerImpl.<init>(Log4jWebInitializerImpl.java:63) ~[?:?]
              at org.apache.logging.log4j.web.Log4jWebInitializerImpl.initialize(Log4jWebInitializerImpl.java:86) ~[?:?]
              at org.apache.logging.log4j.web.WebLoggerContextUtils.getWebLifeCycle(WebLoggerContextUtils.java:83) ~[?:?]
              at org.apache.logging.log4j.web.Log4jServletContainerInitializer.onStartup(Log4jServletContainerInitializer.java:56) ~[?:?]
              at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5196) ~[catalina.jar:8.5.20]
              at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ~[catalina.jar:8.5.20]
              ... 10 more
      

        Attachments

          Activity

            People

            • Assignee:
              ralph.goers@dslextreme.com Ralph Goers
              Reporter:
              ralph.goers@dslextreme.com Ralph Goers
            • Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: