1

Following errors are arising, while deploying war file in Tomcat Server

I executed the following steps,

1) Downloaded the Apache Tomcat Zip

2) Extracted it to Drive D

3) Added JAVA_HOME,JRE_HOME,CATALINA_HOME environment variables

4) Started the Tomcat Server startup.bat (Server started successfully)

5) Added a war file, which was created from a maven project in eclipse

6) Server started to deploy the war file

7) After Deployment the following errors are arising

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

Tried to run this from Eclipse- Add server option (creating the same set of errors)

sridhar3525
  • 49
  • 1
  • 11

2 Answers2

1

This is basically a result of version conflict. Please look up whether the JVM of TomCat and that of the WAR are same.
I surmise, your WAR is also missing on the org.apache.commons.logging library.
Consider adding Apache Commons Logging on to your build path.

CodeWalker
  • 2,281
  • 4
  • 23
  • 50
1

The error in the stack trace seems to point to a class not found (Caused by: java.lang.NoClassDefFoundError: Lorg/apache/commons/logging/Log;) . That makes me guess that there is a missing dependency somewhere in the application. Can you try downloading commons-logging and include them as part of packaging , possibly in your war file or include the jars in tomcat to see if the error goes away. You can also see answers on this question for a similar error. Tomcat doesn't start on eclipse

Ramachandran.A.G
  • 4,788
  • 1
  • 12
  • 24
  • I added the commons-logging jar file in the lib folder of apache tomcat, the exception got removed. But it is throwing serious of exceptions regarding spring framework. http://shrib.com/SpringError the Link for exception trace. – sridhar3525 Aug 24 '16 at 10:01
  • Please add your spring applicationContext XML for troubleshooting. Chances are your beans are not registered using @Component annotations or the packages are not being scanned like this (https://stackoverflow.com/questions/11759040/injection-of-autowired-dependencies-failed-nested-exception-is-org-springframew) – Ramachandran.A.G Aug 24 '16 at 10:19