A child container failed during start java.util.concurrent.ExecutionException

随声附和 提交于 2019-11-28 04:43:44
Naman

I think you will find similar problem here:

java.lang.ClassNotFoundException: HttpServletRequest

And probably answer too. Hope this helps.

You must have packaged the servlet-api.jar along with the other libraries in your war file. You can verify this by opening up your war file and navigating to the WEB-INF/lib folder.

Ideally, you should not provide the servlet-api jar. The container, in your case Tomcat, is responsible for providing it at deploy time to your application. If you try to provide it as well, then issues arise due to version mismatch etc. Best practise is to just avoid packaging it. Remove it from the WEB-INF/lib.

Additional Information

If you are using maven for your packaging, then simply add the provided tag with the dependency and maven will make sure not to package it in the final war file. Something like

<dependency>
    <artifact>..
    <group> ...
    <version> ...
    <scope>provided</scope>
</<dependency>

Your webapp has servletcontainer specific libraries like servlet-api.jar file in its /WEB-INF/lib. This is not right.

Remove them all.

The /WEB-INF/lib should contain only the libraries specific to the webapp, not to the servletcontainer. The servletcontainer (like Tomcat) is the one who should already provide the servletcontainer specific libraries.

If you supply libraries from an arbitrary servletcontainer of a different make/version, you'll run into this kind of problems because your webapp wouldn't be able to run on a servletcontainer of a different make/version than where those libraries are originated from.

How to solve: In Eclipse Right click on the project in eclipse Properties -> Java Build Path -> Add library -> Server Runtime Library -> Apache Tomcat

Im Maven Project:-

add follwing line in pom.xml file

<dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>${default.javax.servlet.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>${default.javax.servlet.jsp.version}</version>
            <scope>provided</scope>
        </dependency>

I faced similar issue and it was caused because I had written WebServlet Path in the .java file as well as in the web.xml . Removing it from any one location works fine for me.

In the .java file

@WebServlet("/index1.jsp")

and in web.xml

<servlet>
    <servlet-name>Logout</servlet-name>
    <servlet-class>tpc.Logout</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>Logout</servlet-name>
    <url-pattern>/index1.jsp</url-pattern>
</servlet-mapping>

Delete the project named Servers (or Servers1, Servers2 which contains your server.xml), find it in Package Explorer(workspace)

Remove server from Eclipse : Go to Window > Preferences > Server > Runtime Environment, here remove the server your are using from eclipse and add it again(doing this will create a new Server project folder in Eclipse) ,

Remove server from Project : Also remove the server in your project(Build path > configuration path > Java Build path) and add again.

now you got a fresh Server project which will not have Multiple Context on its server.xml, only deleting duplicate path in server.xml solved the exixting issue but still server dint start, by doing this Server started(Apache Tomcat v7) and worked normal

And i dont know whether this is good practice or not, i am a starter in programming.

I try with http servlet and I find this issue when I write duplicated @WebServlet ,I encountered with this issue.After I remove or change @WebServlet value it is working.

1.Class

@WebServlet("/display")
public class MyFirst extends HttpServlet {

2.Class

@WebServlet("/display")
public class MySecond extends HttpServlet {

check if you JAVA_HOME is set to 1.7 or below. because tomcat 7 is not compatible with jdk 1.8

This worked for me

This is what worked for me:

1) add commons-logging.jar to the WEB-INF/lib folder

2) Add this jar as a maven dependency, e.g. add this to the pom.xml:

 <dependency>
    <groupId>commons-logging</groupId>
    <artifactId>commons-logging</artifactId>
    <version>1.2</version>
 </dependency>

3) Maven install

4) Run the server.

Hope it helps.

I faced similar issue with similar logs. I was using JDK 1.6 with apache tomcat 7. Setting java_home to 1.7 resolved the issue.

Some time this problem occur due to incompatible java version and tomcat version.Choose the compatible version of both.

Faced the same issue. Changed the JRE to the correct 1.8 version and do a maven clean and build resolve the issue. You may need to change the Project Facet and verify the correct path.

  1. download commons-logging-1.1.1.jar.
  2. Go to Your project,build path, configure build path, java build path.
  3. Add external jars.. add commons-logging-1.1.1.jar
  4. click on apply, ok
  5. Go to project, properties, Deployment Assembly, Click on add,Java build path entries, next, select commons logging jar,ok,,apply, ok..
  6. Delete server,clean ur proejct, add server, Run your project.

Added AWS dependency and had this error. When I remove it from pom the error is gone. Probably you might have the same situation.

This issue might also be caused by a broken Maven repository.

I observe the SEVERE: A child container failed during start message from time to time when working with Eclipse. My Eclipse workspace has several projects. Some of the projects have common external dependencies. If Maven repository is empty (or I add new dependencies into pom.xml files), Eclipse starts downloading libraries specified in pom.xml into Maven repository. And Eclipse does that in parallel for several projects in the workspace. It might happen that several Eclipse threads would be downloading the same file simultaneously into the same place in Maven repository. As a result, this file becomes corrupted.

So, this is how you could resolve the issue.

  1. Close your Eclipse.
  2. If you know which specific jar-file is broken in Maven repository, then delete that file.
  3. If you do not know which file is broken in Maven repository, then delete the whole repository (rm -rf $HOME/.m2).
  4. For each project, run mvn package in the command line. It is important to run the command for each project one-by-one, not in parallel; thus, you ensure that only one instance of Maven runs each time.
  5. Open your Eclipse.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!