Tomcat 无法通过 Hudson 从 Cargo 插件部署,NoClassDefFoundError
我在运行 HtmlUnit 测试用例的 Maven 配置文件设置方面遇到一些问题。这 profile 使用 Maven Cargo 插件来部署应用程序,然后在部署的应用程序上使用 HtmlUnit 运行接口测试。
在我的本地计算机上,我每次都能够干净地运行此 Maven 配置文件,而不会失败,但是在运行 Hudson(版本 1.386)的持续集成服务器上,无论是否能够部署,此配置文件都会受到影响。我的 Tomcat 日志显示此错误:
严重:配置 org.apache.myfaces.webapp.StartupServletContextListener 类的应用程序侦听器时出错 java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory 在 org.apache.myfaces.webapp.AbstractMyFacesListener.(AbstractMyFacesListener.java:36) 在 sun.reflect.NativeConstructorAccessorImpl.newInstance0(本机方法) 在 sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) 在 sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) 在 java.lang.reflect.Constructor.newInstance(Constructor.java:513) 在 java.lang.Class.newInstance0(Class.java:355) 在 java.lang.Class.newInstance(Class.java:308) 在 org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4079) 在 org.apache.catalina.core.StandardContext.start(StandardContext.java:4630) 在 org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) 在 org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) 在 org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546) 在org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1041) 在 org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:964) 在 org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502) 在 org.apache.catalina.startup.HostConfig.check(HostConfig.java:1345) 在 org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:303) 在 org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) 在 org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337) 在 org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601) 在 org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610) 在 org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590) 在 java.lang.Thread.run(Thread.java:662) 引起原因:java.lang.ClassNotFoundException:org.apache.commons.logging.LogFactory 在 org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645) 在 org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491) ... 23 更多
这个问题令人困惑,因为如果不对代码进行任何更改,并且完全相同的代码在我的本地计算机上完美运行,它可能会发生,也可能不会发生。该问题/错误纯粹是 Cargo 插件内部署的一部分,但没有明确的原因发生。任何想法、建议或解决方案都会对我有很大帮助。
更多详细信息:
本地计算机(运行):Windows 7 64 位、Maven 2.2.1、Tomcat 6.0.32
CIS 服务器(失败):Windows 2008 Server 64 位、Maven 2.2.1、雄猫 6.0.32,哈德逊 1.386。
Maven命令&目标:“mvn clover2:instrument clover2:clover site -P 集成”(集成是 Maven 配置文件)
I am having some issues with a Maven profile setup to run HtmlUnit test cases. The
profile uses the Maven Cargo plugin to deploy the application and then subsequently run interface tests with HtmlUnit on the deployed application.
On my local machine I am able to run this Maven profile cleanly without fail every time, however on my continuous integration server which is running Hudson (ver. 1.386) this profile is hit or miss whether it is able to deploy or not. My Tomcat log shows this error:
SEVERE: Error configuring application listener of class org.apache.myfaces.webapp.StartupServletContextListener
java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at org.apache.myfaces.webapp.AbstractMyFacesListener.(AbstractMyFacesListener.java:36)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4079)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4630)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1041)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:964)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1345)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:303)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
... 23 more
The problem is perplexing because it can happen or it could not happen without ANY changes on the code and the fact that the exact same code runs perfectly on my local machine. The problem/error is purely part of the deployment within the Cargo plugin, but there is no clear reason why it is occurring. Any thoughts, advice, or solutions would be a great deal of help for me.
Some more details:
Local machine(runs): Windows 7 64-bit, Maven 2.2.1, Tomcat 6.0.32
CIS Server(fails): Windows 2008 Server 64-bit, Maven 2.2.1, Tomcat 6.0.32, Hudson 1.386.
Maven command & goals: "mvn clover2:instrument clover2:clover site -P integration" (integration is the Maven profile)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否看过 http://commons.apache.org/logging/troubleshooting 的最后一部分.html ?
Have you had a look at the last section of http://commons.apache.org/logging/troubleshooting.html ?