org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]]A child container failed during start
Asked Answered
G

13

17

I am struggling for the past 6-7 hrs trying to figure out what went wrong with my Apache Tomcat Server. In all of my projects, the jdk version got switched to 1.6 from 1.8.

To solve the version conflict, I verified whether compiled version and JVM of Tomcat version are same by taking help from here.

For multiple contexts with the same path error, I know i need to remove duplicate Context tags in server.xml. So, first I check in Servers project (which gets created itself when you add Apache Tomcat Server in Eclipse) and find none there. So, I delve deep into the directory(Eclipse WorkSpace) metadata\.plugins\org.eclipse.wst.server.core\tmp3\conf and removed the duplicate Context tags over there, with help taken from here.

Now when i create a new Dynamic Web Project, everything works fine and I am able to see the web page. But if I try to access any of the HTML, XHTML files of those old project in which the jdk got changed, this org.apache.catalina.LifecycleException continues to pop up and the server fails to start, and consequently these duplicate Context tags continues to build up again and again every time i start the server.

None of my old Web application projects seems to work now.

java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext [/EdBurns_ChrisSchalk]]..... SEVERE: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]] .... Caused by: java.lang.RuntimeException: Unexpected element value kind in annotation: 0

How to prevent these context tags being build up again and again in server.xml. Secondly, how to get back those old web projects to working state again?

Granjon answered 26/2, 2015 at 21:53 Comment(1)
E
9

This will prevent multiple context tags to be created upon each request

1) Stop the server
2) Clean Tomcat's work directory

Screenshot for location:

Externalization answered 4/3, 2015 at 11:41 Comment(6)
It worked for me, but I removed the synchronized application from it.Denominative
This is not the correct solution. This might have worked under certain environments, but not all.Lowland
Yes, this worked for me too when i used clean command... Thank you.Teasel
This is Not a Solution that work all time. It is not working for me even after follow the step same error.Chappelka
I'm using the tomcat from xamppCloy
Could not publish server configuration for Tomcat v9.0 Server at localhost. Multiple Contexts have a path of "/Demo".Strata
P
18

I had a similar error and fixed it by following steps: 1. Under Servers project (which gets created itself when you add Apache Tomcat Server in Eclipse), open server.xml 2. Comment out the line

<Context docBase=... />
Primary answered 22/2, 2017 at 1:32 Comment(3)
@Primary Commenting this element solved my errors too but when I launched my application it seems not working, so commenting this element is not right I guessKolomna
I know it stops the project, but certainly gives a way out - this should be an accepted answer. Thanks mate.Crease
When we remove the context docbase, it just starts the server without any context so obviously the error will be resolved. We need to know how to start the server with the context and resolve the above mentioned error. Hence this solution should not be considered valid.Told
E
9

This will prevent multiple context tags to be created upon each request

1) Stop the server
2) Clean Tomcat's work directory

Screenshot for location:

Externalization answered 4/3, 2015 at 11:41 Comment(6)
It worked for me, but I removed the synchronized application from it.Denominative
This is not the correct solution. This might have worked under certain environments, but not all.Lowland
Yes, this worked for me too when i used clean command... Thank you.Teasel
This is Not a Solution that work all time. It is not working for me even after follow the step same error.Chappelka
I'm using the tomcat from xamppCloy
Could not publish server configuration for Tomcat v9.0 Server at localhost. Multiple Contexts have a path of "/Demo".Strata
H
5

If you are not using annotation based Servlet then please remove annotation @WebServlet("/YourServletName") from the starting of the servlet. This annotation confuses the mapping with web.xml, after removing this annotation Tomcat server will work properly.

Heimer answered 3/5, 2016 at 6:24 Comment(0)
C
2

This seems to be an issue with local Maven repository. (i.e. .m2 folder) may be due to some corrupt .jar file

For me, the following actions helped to overcome this issue.

  1. On my local file system, I've deleted the directory .m2 (Maven local repository)

  2. In Eclipse, updated the project (select Maven > Update Project)

  3. Ran the app again on Tomcat server.

Crossroads answered 2/8, 2018 at 15:58 Comment(0)
A
1

Went through the various resources on the net but none of them helped then i deleted the existing server and added the same server again and now it is working fine and the steps are

Window>>ShowView>>Servers>>RightClick>>Delete

and then add the server again as you have added previously.

Abba answered 19/12, 2016 at 6:16 Comment(0)
L
1

If you are using the following stack: Server Version: Apache Tomcat/9.0.21 Servlet Version: 4.0 JSP Version: 2.3

Then try adding <absolute-ordering /> to your web.xml file. So your file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
  <display-name>spring-mvc-crud-demo</display-name>

  <absolute-ordering />

  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>index.html</welcome-file>
  </welcome-file-list>

  ......
Leyva answered 9/7, 2019 at 11:41 Comment(0)
G
0

In my case, the servlet-api.jar file in jre/lib/ext in the jdk directory conflicts with the servlet-api.jar file in tomcat, removing the servlet-api.jar in jre/lib/ext in the jdk directory can solve the problem.

Greatcoat answered 8/7, 2018 at 18:32 Comment(0)
B
0

Just make sure build with correct web.xml configuration.I have update web.xml with tomcat configuration and it worked for me. Sample :-

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
	id="WebApp_ID" version="2.5">
	<display-name>simulator</display-name>
	<description>simulator app</description>


    <!-- File upload  -->
    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
    </welcome-file-list>
 <!-- excel simulation -->
    <display-name>simulator</display-name>
    <description>simulator app</description>
    <!-- File upload  -->
    <welcome-file-list>
        <welcome-file>InsertPage.html</welcome-file>
    </welcome-file-list>
    <servlet>
        <servlet-name>FileUploadServlet</servlet-name>
        <servlet-class>clari5.excel.FileUploadServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>FileUploadServlet</servlet-name>
        <url-pattern>/excelSimulator/FileUploadServlet</url-pattern>
    </servlet-mapping>



</web-app>
Brunner answered 27/3, 2019 at 13:45 Comment(0)
F
0

One of the problems that can cause this is when you forget to put the / character in the WebServlet annotation @WebServlet("/example") @WebServlet("example") I hope it works, it worked for me.

Frosting answered 2/7, 2019 at 12:31 Comment(0)
S
0

Below solution worked for me: Navigate to Project->Clean.. Clean all the projects referenced by Tomcat server Refresh the project you're trying to run on Tomcat

Try to run the server afterwards

Somewhere answered 16/6, 2020 at 5:36 Comment(0)
B
0

We meet the same issue (failed to stop component) in a container, alpine 316 , openjdk17 and fixed by remove the container and build (docker built -t ) it againt.

another error msg following: ERROR 1 --- [main] org.apache.catalina.core.ContainerBase - A child container failed during stop

Basin answered 13/9, 2023 at 10:5 Comment(1)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Trici
T
-1

I think it is jar file version problem. I had the same issue and I fixed it by changing the commons-codec-1.6.jar file from the build path. Earlier I was using latest version 1.10. Gradually I decreased the versions and 1.6 version fixed my issue.

Tonsorial answered 3/1, 2017 at 4:10 Comment(0)
P
-3

Go to the task manager, kill the java processes and turn the server back on. should work fine.

Polyzoic answered 18/12, 2016 at 18:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.