在Tomcat服务器中部署war文件时出现以下错误
我执行了以下步骤,
1(下载了Apache Tomcat Zip
2(将其解压缩到驱动器D
3( 新增JAVA_HOME、JRE_HOME、CATALINA_HOME环境变量
4( 启动 Tomcat 服务器启动.bat (服务器启动成功(
5(添加了一个war文件,该文件是从eclipse中的maven项目创建的
6( 服务器开始部署战争文件
7( 部署后出现以下错误
webappsIT_Inventory.war
24-Aug-2016 13:06:08.313 SEVERE [localhost-startStop-1] org.apache.catalina.core
.ContainerBase.addChildInternal ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: Failed to start component [StandardEngi
ne[Catalina].StandardHost[localhost].StandardContext[/IT_Inventory]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:158)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:724)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:70
0)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:952)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:
1823)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: Lorg/apache/commons/logging/Log;
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Unknown Source)
at java.lang.Class.getDeclaredFields(Unknown Source)
at org.apache.catalina.util.Introspection.getDeclaredFields(Introspectio
n.java:110)
at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(Web
AnnotationSet.java:262)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAn
notations(WebAnnotationSet.java:136)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotatio
ns(WebAnnotationSet.java:66)
at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfi
g(ContextConfig.java:327)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfi
g.java:774)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfi
g.java:298)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBa
se.java:94)
at org.apache.catalina.core.StandardContext.startInternal(StandardContex
t.java:5076)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:152)
... 10 more
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.Log
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClas
sLoaderBase.java:1284)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClas
sLoaderBase.java:1118)
... 23 more
24-Aug-2016 13:06:08.320 SEVERE [localhost-startStop-1] org.apache.catalina.star
tup.HostConfig.deployWAR Error deploying web application archive D:apache-tomca
t-8.5.4webappsIT_Inventory.war
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.cata
lina.LifecycleException: Failed to start component [StandardEngine[Catalina].Sta
ndardHost[localhost].StandardContext[/IT_Inventory]]
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:728)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:70
0)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:952)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:
1823)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
24-Aug-2016 13:06:08.325 INFO [localhost-startStop-1] org.apache.catalina.startu
p.HostConfig.deployWAR Deployment of web application archive D:apache-tomcat-8.
5.4webappsIT_Inventory.war has finished in 2,017 ms
尝试从 Eclipse - 添加服务器选项运行此选项(创建相同的错误集(
堆栈跟踪中的错误似乎指向未找到(Caused by: java.lang.NoClassDefFoundError: Lorg/apache/commons/logging/Log;)
的类。这让我猜测应用程序中某处缺少依赖项。您可以尝试下载共享资源日志记录并将它们作为打包的一部分包含在 ,可能在您的战争文件中,或者将罐子包含在 tomcat 中以查看错误是否消失。您还可以查看有关类似错误的此问题的答案。雄猫不是从日食开始的
基本上是version
冲突的结果。请检查TomCat
和WAR
的JVM
是否相同。
我猜想,你的WAR
在org.apache.commons.logging
图书馆里也不见了。
考虑将 Apache Commons Logging 添加到您的构建路径中。