我们有一个使用Log4j2并在WAS 8.5上运行的应用程序。我们选择了类加载选项作为PARENT_LAST,因此将从WEB-INF / lib中选取jar文件。启动服务器时出现以下错误,我们收到错误。
com.ibm.ws.exception.RuntimeWarning: com.ibm.ws.webcontainer.exception.WebAppNotLoadedException: Failed to load webapp: Failed to load webapp: javax.servlet.ServletContainerInitializer: Provider org.apache.logging.log4j.web.Log4jServletContainerInitializer not a subtype
at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:432)
at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:718)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1177)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1370)
at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:639)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:968)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:776)
at com.ibm.ws.runtime.component.ApplicationMgrImpl$5.run(ApplicationMgrImpl.java:2195)
at com.ibm.ws.security.auth.ContextManagerImpl.runAs(ContextManagerImpl.java:5387)
at com.ibm.ws.security.auth.ContextManagerImpl.runAsSystem(ContextManagerImpl.java:5603)
at com.ibm.ws.security.core.SecurityContext.runAsSystem(SecurityContext.java:255)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2200)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:435)
at com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:378)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access$500(CompositionUnitMgrImpl.java:126)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:984)
at com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:502)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1865)
Caused by: com.ibm.ws.webcontainer.exception.WebAppNotLoadedException: Failed to load webapp: Failed to load webapp: javax.servlet.ServletContainerInitializer: Provider org.apache.logging.log4j.web.Log4jServletContainerInitializer not a subtype
at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:759)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:634)
at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:426)
... 18 more
Caused by: com.ibm.ws.webcontainer.exception.WebAppNotLoadedException: Failed to load webapp: javax.servlet.ServletContainerInitializer: Provider org.apache.logging.log4j.web.Log4jServletContainerInitializer not a subtype
at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:176)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:749)
... 20 more
Caused by: java.util.ServiceConfigurationError: javax.servlet.ServletContainerInitializer: Provider org.apache.logging.log4j.web.Log4jServletContainerInitializer not a subtype
at java.util.ServiceLoader.fail(ServiceLoader.java:243)
at java.util.ServiceLoader.access$300(ServiceLoader.java:193)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:381)
at java.util.ServiceLoader$1.next(ServiceLoader.java:457)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initializeServletContainerInitializers(WebAppImpl.java:535)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:409)
at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88)
at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:169)
当我们将lo4j2相关的jar作为服务器的ext文件夹的一部分时,它工作正常,没有任何问题。 我们还有log4j jar以及一些第三方jar使用的应用程序的一部分。 有些人可以抛出一些亮点,以及为什么会抛出这个错误?
答案 0 :(得分:0)
如果您正在使用web.xml进行应用程序配置,请参阅以下链接以配置与log4j-web模块相关的侦听器和过滤器。