Java Log4JLogger 在 websphere 8.5.01 上部署时不实现 Log

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21240589/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 07:34:42  来源:igfitidea点击:

Log4JLogger does not implement Log when deploying on websphere 8.5.01

javalog4jwebspherewebsphere-8apache-commons-logging

提问by jesantana

I am facing this problem when trying to deploy an EAR file to websphere 8.5.0.1. The EAR only contains on its dependencies

我在尝试将 EAR 文件部署到 websphere 8.5.0.1 时遇到了这个问题。EAR 仅包含其依赖项

commons-logging-1.1.3.jar, log4j-1.2.17.jar

commons-logging-1.1.3.jar, log4j-1.2.17.jar

and a single JSF page. As a remark, in the classpath by default must be a common-loggins copy, so deleting the library is not an option. The problem ocurs when initiliazing the server provided myfaces library, which needs commons-logging. The stack trace is pasted at the bottom. The application and we module classloaders are setted as parent last.

和单个 JSF 页面。需要说明的是,默认情况下,类路径中必须是 common-loggins 副本,因此删除库不是一种选择。初始化服务器提供的 myfaces 库时会出现问题,该库需要 commons-logging。堆栈跟踪粘贴在底部。应用程序和我们模块类加载器最后设置为父级。

Any help will be highly appreciated

任何帮助将不胜感激

An error occured while initializing MyFaces: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Class org.apache.commons.logging.impl.Log4JLogger does not implement Log
          org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Class org.apache.commons.logging.impl.Log4JLogger does not implement Log
    at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:532)
    at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:272)
    at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:414)
    at org.apache.commons.digester.Digester.<init>(Digester.java:308)
    at org.apache.myfaces.config.impl.digester.DigesterFacesConfigUnmarshallerImpl.<init>(DigesterFacesConfigUnmarshallerImpl.java:42)
    at org.apache.myfaces.config.DefaultFacesConfigurationProvider.getUnmarshaller(DefaultFacesConfigurationProvider.java:93)
    at org.apache.myfaces.config.DefaultFacesConfigurationProvider.getStandardFacesConfig(DefaultFacesConfigurationProvider.java:131)
    at org.apache.myfaces.config.DefaultFacesConfigurationMerger.getFacesConfigData(DefaultFacesConfigurationMerger.java:69)
    at org.apache.myfaces.config.FacesConfigurator.configure(FacesConfigurator.java:456)
    at org.apache.myfaces.webapp.AbstractFacesInitializer.buildConfiguration(AbstractFacesInitializer.java:313)
    at org.apache.myfaces.webapp.Jsp21FacesInitializer.initContainerIntegration(Jsp21FacesInitializer.java:73)
    at org.apache.myfaces.webapp.AbstractFacesInitializer.initFaces(AbstractFacesInitializer.java:136)
    at org.apache.myfaces.webapp.StartupServletContextListener.contextInitialized(StartupServletContextListener.java:111)
    at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:1676)
    at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:414)
    at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88)
    at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:169)
    at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:749)
    at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:634)
    at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:426)
    at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:718)
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1173)
    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:772)
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2175)
    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:445)
    at com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123)
    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:388)
    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access0(CompositionUnitMgrImpl.java:116)
    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:994)
    at com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:349)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1814)
Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Class org.apache.commons.logging.impl.Log4JLogger does not implement Log
    at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:416)
    at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:525)
    ... 33 more
Caused by: org.apache.commons.logging.LogConfigurationException: Class org.apache.commons.logging.impl.Log4JLogger does not implement Log
    at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:412)
    ... 34 more

采纳答案by dmarrazzo

WAS leverages apache common logging for this reason using it in your EAR with Parent Last policy break the runtime consistency and you get that exception.

由于这个原因,WAS 利用 apache 公共日志记录在您的 EAR 中使用 Parent Last 策略破坏运行时一致性,并且您会得到该异常。

I suggest you to remove that jar from your application to use the WAS provided one. For further details: Configuring applications to use Jakarta Commons Logging

我建议您从应用程序中删除该 jar 以使用 WAS 提供的一个。有关更多详细信息: 配置应用程序以使用 Jakarta Commons Logging

回答by ACV

Could be that you have 2 versions of commons-logging jar on the classpath. Remove one of them.

可能是您在类路径上有 2 个版本的 commons-logging jar。删除其中之一。