49

I encountered this error when I tried to run my application in Tomcat. I already checked the version of tomcat and java home. Both use java 6.

Is there a missing jar? Or is it my web xml? I'm not using any maven tool.

SEVERE: ContainerBase.addChild: start: 
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/ICard]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:618)
    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:650)
    at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1582)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: javax/xml/rpc/handler/soap/SOAPMessageContext
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(Unknown Source)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2904)
    at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1173)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1681)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
    at java.lang.Class.getDeclaredMethods(Unknown Source)
    at org.apache.catalina.util.Introspection.getDeclaredMethods(Introspection.java:108)
    at org.apache.catalina.startup.WebAnnotationSet.loadMethodsAnnotation(WebAnnotationSet.java:279)
    at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAnnotations(WebAnnotationSet.java:141)
    at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:67)
    at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:405)
    at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:881)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:369)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5173)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ... 11 more
Caused by: java.lang.ClassNotFoundException: javax.xml.rpc.handler.soap.SOAPMessageContext
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
    ... 33 more
Jan 10, 2014 4:05:06 PM org.apache.catalina.startup.HostConfig deployDescriptor
SEVERE: Error deploying configuration descriptor F:\RCBC\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\conf\Catalina\localhost\ICard.xml
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/ICard]]
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:904)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:618)
    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:650)
    at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1582)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Jan 10, 2014 4:05:06 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8100"]
Jan 10, 2014 4:05:06 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Jan 10, 2014 4:05:06 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 4003 ms
ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
james goooseling
  • 771
  • 1
  • 6
  • 7

21 Answers21

27

Got the solution for this problem.... Wooo

  1. Make sure that Appliction server (Tomcat etc.) uses the same java runtime version as per what your java application is using.

  2. Make sure that your using jre path not jdk path for the runtime enviroments

  3. Make sure when creating a project select the appropriate server runtime versions.

james goooseling
  • 771
  • 1
  • 6
  • 7
  • "Make sure that your using jre path not jdk path for the runtime enviroments" Yep, there's the culprit. Thank you for this detail, you just saved my day. – Alkanshel Feb 21 '18 at 21:17
  • 15
    How should I configure Tomcat so that it uses the jre path not jdk path? – Shaohua Huang Aug 17 '18 at 05:19
19

This issue arises because of different reasons. It might encountered if you are using Spring boot built war file. As Spring boot web and rest starter projects jars do have embedded Tomcat in it, hence fails with "SEVERE: ContainerBase.addChild: start: org.apache.catalina.LifecycleException".

You can fix this by exclusion of the embedded tomcat at the time of packaging by using exclusions in case of maven.

Maven dependency of "spring-boot-starter-web" will look like

   <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <exclusions>
            <exclusion>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-tomcat</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
nkharche
  • 917
  • 9
  • 10
  • After exclude the spring-boot-starter-tomcat, there will be compilation error. – Shaohua Huang Aug 17 '18 at 04:51
  • There would not be compilation error unless you are using APIs provided by the embedded tomcat. If you want to use APIs provided by embedded tomcat use it with provided scope. – nkharche Aug 29 '18 at 02:22
  • Thanks for reply. The compilation error is due to other dependencies. – Shaohua Huang Aug 29 '18 at 03:32
  • The solution in this case here, should be just to use provided. See the answer here: https://stackoverflow.com/questions/35224311/severe-containerbase-addchild-start-org-apache-catalina-lifecycleexception-f – f1v3 Mar 19 '21 at 11:28
11

According to me, this would happen if there are two offending classes of same name but with different version. Usually, it happens due to servlet-api.jar. If its present in lib folder of your war, then pls remove it using whichever tool used for building war. Or in case of maven, add the dependency with scope specified as "provided". This will solve the compilation issue and at run time it will refer to jar provided by server environment. Pls configure the dependency as follows:

<dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>3.0.1</version>
        <scope>provided</scope>
</dependency>
Mahesh C.
  • 233
  • 3
  • 7
3

What caused this error in my case was having two @GET methods with the same path in a single resource. Changing the @Path of one of the methods solved it for me.

gabrielkerekes
  • 468
  • 4
  • 10
3

My problem was that I had @WebServlet("/route") and the same servlet declared in web.xml

naXa stands with Ukraine
  • 35,493
  • 19
  • 190
  • 259
Kronen
  • 369
  • 9
  • 23
2

Main reason:SOAPMessageContext NoClassDefFoundError So you need import this Class or jar

in IDEA

  1. ctrl+shift+alt+S,“Libraries”,find the absent class.
  2. edit the local Maven config.

.m2/repository/your absent class(for example commons-logging)/.../maven-metadata-central.xml

<?xml version="1.0" encoding="UTF-8"?>
<metadata modelVersion="1.1.0">
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<versioning>
<latest>1.2</latest>
<release>1.2</release>
<versions>
  <version>1.0</version>
  <version>1.0.1</version>
  <version>1.0.2</version>
  <version>1.0.3</version>
  <version>1.0.4</version>
  <version>1.1</version>
  <version>1.1.1</version>
  <version>1.1.2</version>
  <version>1.1.3</version>
  <version>1.2</version>
</versions>
<lastUpdated>20140709195742</lastUpdated>
</versioning>
</metadata>


<latest>your need absend class version and useful</latest>

because Maven will find 'metadata-central.xml' config lastest version as project use version.

forgive my chinese english:)

fonxian
  • 21
  • 2
1

What helped me was deleting my target folder and recompile my project again. This problem occured to me when I used a second server for my tests that needed a server running. Conclusion: delete your target file when you make big changes to the war file.

1

I had a similar problem when deploying one of my portlets. The portlet has been developed for Liferay 6.2 on Windows. My runtime environment is Tomcat 7 running on JRE 1.6 (JRockit 1.6). I have recently migrated to Eclipse 2019-3. I checked my Java Build Path (Project->Properties, Libraries tab). I noticed that the Apache Tomcat that is specified in the list of JARs and class folders on the build path was unbound. I selected that item. I clicked on the Edit button. Server Libary dialog was opened. I selected the correct Apache Tomcat. After applying the change, I redeployed the portlet and the problem was resolved.

Sometimes you may need to delete the problematic portlet from the [Tomcat]/webapps directory before deploying the corrected portlet. Also, sometimes I have experienced that deployment of a portlet takes more than usual, and redeploying it resolves the issue.

Abdollah
  • 4,579
  • 3
  • 29
  • 49
0

Weird error, you can try methods given by james goooseling and also I have done it by following ways:

  • Remove all jars or libraries from build path and lib folders and add them again in lib folder or build path as you wish.

  • Check if you have servlet annotation @WebServlet for given servlet and if it has mapping in web.xml as well .. this is most common error due to which tomcat gets confused , that what url pattern must he use.

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
swapyonubuntu
  • 1,952
  • 3
  • 25
  • 34
0

Please verify your .project and .classpath files. Verify the java version and other reuqired details. If those and missing or mis matched

Atul
  • 3,043
  • 27
  • 39
0

I'm not sure what happened in your case that fixed the issue, but your issue was on this line:

Caused by: java.lang.NoClassDefFoundError: javax/xml/rpc/handler/soap/SOAPMessageContext

You need to add jaxrpc-api.jar to your /libs or add

<dependency>
    <groupId>javax.xml</groupId>
    <artifactId>jaxrpc-api</artifactId>
    <version>x.x.x</version>
</dependency>

to your maven dependencies.

Nielsvh
  • 1,151
  • 1
  • 18
  • 31
0

I had the same error statement following a "Failed to access resource" error message:

Command

#cat callflow-java-logger-1.log.0

Output

Dec 09, 2015 8:09:03 AM org.apache.catalina.loader.WebappLoader startInternal
SEVERE: LifecycleException 
java.io.IOException: Failed to access resource /WEB-INF/lib/ojdbc14.jar

In my case the solution was changing the connector permissions

-rw------- 1 owner creator size date ojdbc14.jar

This file in question wasn't initially located at /WEB-INF/lib, which was probably due to how BIRT works. It can be tricky if you are dealing with a higher number of files.

Alan
  • 1,479
  • 3
  • 20
  • 36
0

In my case the servlet name defined in the web.xml was not same as the sevlet name in the servlet mapping tag. I have corrected this and the WAR was deployed successfully.

Vishnu T S
  • 3,476
  • 2
  • 23
  • 39
0

my problem was with @WebServelet annotation and it was because of the name was repeated, I had two of @WebServlet("/route")in my code by mistake(I copy and pasted and forgot to change the route name)

Iman Mirzadeh
  • 12,710
  • 2
  • 40
  • 44
0

In my case (Spring MVC + Hibernate project), I added Controller, Service, Dao, Model class & Thyme leaf page. Just didn't map new model class in "hibernate.cfg.xml" file. So that got this error. But after mapping new model class again got the error. Then deleted Controller, Service, Dao, Model class. Thyme leaf page and Created newly. Also mapped new model class. Then error has gone.

Atequer Rahman
  • 1,171
  • 10
  • 25
0

On top of all the other stuff, for me this was happening because I was activating NewRelic in my setenv.sh:

NR_JAR=/opt/newrelic/newrelic.jar; export NR_JAR

Once I commented this, removing newrelic's hooks, the issue disappeared. It was only happening for endpoints using apache CXF.

Alkanshel
  • 4,198
  • 1
  • 35
  • 54
0

when working with spring boot the problem was that the tomcat library needs to set to provided

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-tomcat</artifactId>
    <scope>provided</scope>
</dependency>
gischy
  • 154
  • 1
  • 7
0

My reason was having same library with different snapshot versions in WEB-INF/lib:

some-lib-3.14.0.143-SNAPSHOT.jar
some-lib-3.14.0.143-20200708.101204-1.jar

To fix the issue remove redundant copy.

Artur Yakubenko
  • 129
  • 1
  • 1
  • 8
0

in my case,

the issue was due to an application jar,which was not downloaded correctly , and replacing that jar, solved this issue.

nikhil2000
  • 178
  • 3
  • 15
0

In my case (MS Windows, JDK 8, TomEE 7) I got your same errors when trying to start Tomcat as a normal Windows user (not an administrator, nor elevating privileges), after I did a successful setup as user Administrator. Basically Tomcat was working only if I started it as administrator.

By default normal users had no permissions to add/edit files in Tomcat's folders, because Administrator put in place Tomcat's folder structure.

I've solved this issue just by assigning also to normal users those rights needed to modify content of three specific subfolders:

  • %CATALINA_HOME%/logs
  • %CATALINA_HOME%/temp
  • %CATALINA_HOME%/webapps (where %CATALINA_HOME% is the full pathname of binary distribution)

To change the permissions, just open Tomcat's directory (%CATALINA_HOME%) in Windows Explorer, right-click on a specific subfolder and choose Properties. In tab Security press button Edit... (at this point, if logged as normal user, you should be asked for Administrator's password). From list Group or user names choose the group Users. In section Permissions for Users, mark the checkbox of column Allow for the row Modify (this should also automatically add the check for row Write, if not checked before). Apply changes for the three subfolders.

Now you should be able to start Tomcat as non-admin user.

Emilio M.
  • 5
  • 3
0

check your war deployment is pointing to the correct file

sidibe
  • 51
  • 5