在Tomcat服务器中部署war文件时出现以下错误
我执行了以下步骤,
1)下载Apache Tomcat Zip
2)将其提取到Drive D
3)添加了JAVA_HOME,JRE_HOME,CATALINA_HOME环境变量
4)启动Tomcat服务器startup.bat(服务器已成功启动)
5)添加了一个war文件,它是从eclipse中的maven项目创建的
6)服务器开始部署war文件
7)部署后,出现以下错误
webapps\IT_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.4\webapps\IT_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.4\webapps\IT_Inventory.war has finished in 2,017 ms
试图从Eclipse-添加服务器选项(创建相同的错误集)中运行它
答案 0 :(得分:1)
这基本上是JVM
冲突的结果。请查看TomCat
的{{1}}和WAR
的{{1}}是否相同
我猜测,WAR
库中也缺少org.apache.commons.logging
。
请考虑在构建路径上添加Apache Commons Logging。
答案 1 :(得分:1)
堆栈跟踪中的错误似乎指向未找到的类(Caused by: java.lang.NoClassDefFoundError: Lorg/apache/commons/logging/Log;)
。这让我猜测应用程序中某处缺少依赖项。您可以尝试下载commons-logging并将它们作为打包的一部分包含在内,可能在您的war文件中,或者在tomcat中包含jar以查看错误是否消失。您还可以针对类似错误查看此问题的答案。
Tomcat doesn't start on eclipse