我正在尝试实现一个使用axis作为其库之一的salesforce API。当我将所需的axis.jar文件部署到lib / ext目录时,在启动时会收到以下警告,并且在使用API​​时,它也会失败,并显示“无法初始化类org.apache.axis.components.logger “ .LogFactory”运行时错误显示到屏幕。

Rex 06 Aug 2013 19:55:44,091 WARN  [EngineConfigurationFactoryFinder:184] Factory org.apache.axis.configuration.EngineConfigurationFactoryServlet Ignored: missing required method: public static EngineConfigurationFactory newFactory(Object).
Exception in thread "Thread-12" java.lang.ExceptionInInitializerError
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:247)
        at org.apache.axis.utils.ClassUtils$2.run(ClassUtils.java:177)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.apache.axis.utils.ClassUtils.loadClass(ClassUtils.java:160)
        at org.apache.axis.utils.ClassUtils.forName(ClassUtils.java:100)
        at org.apache.axis.deployment.wsdd.WSDDTypeMapping.getSerializer(WSDDTypeMapping.java:217)
        at org.apache.axis.deployment.wsdd.WSDDService.deployTypeMapping(WSDDService.java:542)
        at org.apache.axis.deployment.wsdd.WSDDService.initTMR(WSDDService.java:253)
        at org.apache.axis.deployment.wsdd.WSDDService.<init>(WSDDService.java:233)
        at org.apache.axis.deployment.wsdd.WSDDDeployment.<init>(WSDDDeployment.java:192)
        at org.apache.axis.deployment.wsdd.WSDDDocument.setDocument(WSDDDocument.java:139)
        at org.apache.axis.deployment.wsdd.WSDDDocument.<init>(WSDDDocument.java:65)
        at org.apache.axis.configuration.FileProvider.configureEngine(FileProvider.java:179)
        at org.apache.axis.AxisEngine.init(AxisEngine.java:172)
        at org.apache.axis.AxisEngine.<init>(AxisEngine.java:156)
        at org.apache.axis.server.AxisServer.<init>(AxisServer.java:88)
        at org.apache.axis.server.DefaultAxisServerFactory.createServer(DefaultAxisServerFactory.java:109)
        at org.apache.axis.server.DefaultAxisServerFactory.getServer(DefaultAxisServerFactory.java:73)
        at org.apache.axis.server.AxisServer.getServer(AxisServer.java:73)
        at org.apache.axis.transport.http.AxisServletBase.getEngine(AxisServletBase.java:185)
        at org.apache.axis.transport.http.AxisServletBase.getOption(AxisServletBase.java:396)
        at org.apache.axis.transport.http.AxisServletBase.init(AxisServletBase.java:112)
        at org.apache.axis.transport.http.AxisServlet.init(AxisServlet.java:156)
        at javax.servlet.GenericServlet.init(GenericServlet.java:212)
        at com.liferay.util.axis.AxisServlet.doInit(AxisServlet.java:171)
        at com.liferay.util.axis.AxisServlet$InitThread.run(AxisServlet.java:275)
Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy.  You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed. (Caused by org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy.  You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.) (Caused by org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy.  You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed. (Caused by org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy.  You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.))
        at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543)
        at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
        at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:370)
        at org.apache.axis.components.logger.LogFactory.getLog(LogFactory.java:37)
        at org.apache.axis.encoding.ser.BaseSerializerFactory.<clinit>(BaseSerializerFactory.java:42)
        ... 27 more
Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy.  You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed. (Caused by org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy.  You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.)
        at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:397)
        at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)
        ... 31 more
Caused by: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy.  You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.
        at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:385)
        ... 32 more
Aug 6, 2013 7:55:44 PM org.apache.catalina.startup.HostConfig deployDirectory

最佳答案

Liferay包含axis.jar并加以利用。如果将其放在全局类路径上,以便使您的类优先于Liferay交付/测试过的类路径,则可能是它不起作用。如果不作进一步分析,我想很有可能是这种情况。

您可以通过删除它进行测试。我不知道我建议升级Liferay中的轴的步骤。由于Liferay不包含最新版本,因此我认为更新并不容易,否则可能已经完成了。

当您将axis.jar部署到Web应用程序的WEB-INF/lib目录时,它可以工作吗?

关于java - Liferay记录 Axis 错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/18089398/

10-12 23:45