Java tomcat启动失败(Servlet3.0 Web Project):A child container failed during start

Tomcat启动失败,失败全部信息:

五月 ,  :: 下午 org.apache.tomcat.util.digester.SetPropertiesRule begin
警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:MyEL' did not find a matching property.
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server version: Apache Tomcat/7.0.
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server built: Feb :: UTC
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server number: 7.0.68.0
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: OS Name: Windows
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: OS Version: 6.1
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Architecture: amd64
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Java Home: D:\Java_Study\Java\jdk1..0_79\jre
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM Version: 1.7.0_79-b15
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM Vendor: Oracle Corporation
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_BASE: D:\Java_Study\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_HOME: D:\Java_Study\apache-tomcat-7.0.
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcatalina.base=D:\Java_Study\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcatalina.home=D:\Java_Study\apache-tomcat-7.0.
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dwtp.deploy=D:\Java_Study\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\webapps
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.endorsed.dirs=D:\Java_Study\apache-tomcat-7.0.\endorsed
五月 , :: 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dfile.encoding=UTF-
五月 , :: 下午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\Java_Study\Java\jdk1..0_79\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;D:/Java_Study/Java/jdk1..0_79/bin/../jre/bin/server;D:/Java_Study/Java/jdk1..0_79/bin/../jre/bin;D:/Java_Study/Java/jdk1..0_79/bin/../jre/lib/amd64;D:\Java_Study\Java\jdk1..0_79\bin;D:\Java_Study\Java\jdk1..0_79\jre\bin;D:\Java_Study\mysql-5.7.-winx64\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.\;C:\Program Files (x86)\Microsoft SQL Server\\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\\DTS\Binn\;C:\Program Files\Microsoft SQL Server\\Tools\Binn\;C:\Program Files\Microsoft SQL Server\\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Windows\system32\config\systemprofile\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Microsoft SQL Server\\Tools\Binn\;C:\Program Files (x86)\Windows Kits\\Windows Performance Toolkit\;C:\Program Files (x86)\nodejs\;D:\Java_Study\apache-maven-3.3.\bin;C:\Users\Administrator\AppData\Roaming\npm;D:\Java_Study\eclipse;;.
五月 , :: 下午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["http-bio-8080"]
五月 , :: 下午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["ajp-bio-8009"]
五月 , :: 下午 org.apache.catalina.startup.Catalina load
信息: Initialization processed in ms
五月 , :: 下午 org.apache.catalina.core.StandardService startInternal
信息: Starting service Catalina
五月 , :: 下午 org.apache.catalina.core.StandardEngine startInternal
信息: Starting Servlet Engine: Apache Tomcat/7.0.
五月 , :: 下午 org.apache.catalina.core.ContainerBase startInternal
严重: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/MyEL]]
at java.util.concurrent.FutureTask.report(FutureTask.java:)
at java.util.concurrent.FutureTask.get(FutureTask.java:)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:)
at java.util.concurrent.FutureTask.run(FutureTask.java:)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:)
at java.lang.Thread.run(Thread.java:)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/MyEL]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:)
... more
Caused by: java.lang.IllegalArgumentException: The servlets named [MyELServlet] and [com.dx.app.MyELServlet] are both mapped to the url-pattern [/MyELServlet] which is not permitted
at org.apache.catalina.deploy.WebXml.addServletMapping(WebXml.java:)
at org.apache.catalina.startup.ContextConfig.processAnnotationWebServlet(ContextConfig.java:)
at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:)
at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:)
at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:)
at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:)
at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:)
... more 五月 , :: 下午 org.apache.catalina.core.ContainerBase startInternal
严重: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
at java.util.concurrent.FutureTask.report(FutureTask.java:)
at java.util.concurrent.FutureTask.get(FutureTask.java:)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:)
at org.apache.catalina.startup.Catalina.start(Catalina.java:)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:)
at java.lang.reflect.Method.invoke(Method.java:)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:)
at java.util.concurrent.FutureTask.run(FutureTask.java:)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:)
at java.lang.Thread.run(Thread.java:)
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:)
... more 五月 , :: 下午 org.apache.catalina.startup.Catalina start
严重: The required Server component failed to start so Tomcat is unable to start.
org.apache.catalina.LifecycleException: Failed to start component [StandardServer[]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:)
at org.apache.catalina.startup.Catalina.start(Catalina.java:)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:)
at java.lang.reflect.Method.invoke(Method.java:)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Catalina]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:)
... more
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:)
... more
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:)
... more 五月 , :: 下午 org.apache.coyote.AbstractProtocol pause
信息: Pausing ProtocolHandler ["http-bio-8080"]
五月 , :: 下午 org.apache.coyote.AbstractProtocol pause
信息: Pausing ProtocolHandler ["ajp-bio-8009"]
五月 , :: 下午 org.apache.catalina.core.StandardService stopInternal
信息: Stopping service Catalina
五月 , :: 下午 org.apache.coyote.AbstractProtocol destroy
信息: Destroying ProtocolHandler ["http-bio-8080"]
五月 , :: 下午 org.apache.coyote.AbstractProtocol destroy
信息: Destroying ProtocolHandler ["ajp-bio-8009"]

找到:/WEB-INF/web.xml

 <?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"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0">
<display-name>MyEL</display-name>
<welcome-file-list>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
10 <servlet>
11 <servlet-name>MyELServlet</servlet-name>
12 <servlet-class>com.dx.app.MyELServlet</servlet-class>
13 </servlet>
14 <servlet-mapping>
15 <servlet-name>MyELServlet</servlet-name>
16 <url-pattern>/MyELServlet</url-pattern>
17 </servlet-mapping>
</web-app>

解决方案:

去掉其中的<servlet>标注信息

因为在Servlet类上边已经注解了servlet映射信息,所以不需要重复标注。

 package com.dx.app;

 import java.io.IOException;

 import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; @WebServlet("/MyELServlet")
public class MyELServlet extends HttpServlet {
private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.getWriter().append("Served at: ").append(request.getContextPath());
request.setAttribute("Hello", "Hello Servlet!");
// 请求转发:
// 1、调用HttpServletRequest 的getRequestDispatcher()的方法,获取RequestDispatcher对象
// 调用getRequestDispatcher()需要传入转发的地址。
String servletName="MyDispatcherServlet";
RequestDispatcher requestDispatcher=request.getRequestDispatcher("/"+servletName); // 2、调用HttpServletRequest的forward(request,response)方法。
requestDispatcher.forward(request, response);
}
}
上一篇:UWP学习记录2-设计和UI之布局


下一篇:Linux - 设置Centos控制台模式的分辨率