Tomcat启动失败,失败全部信息:
五月 11, 2016 10:21:04 下午 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. 五月 11, 2016 10:21:04 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Server version: Apache Tomcat/7.0.68 五月 11, 2016 10:21:04 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Server built: Feb 8 2016 20:25:54 UTC 五月 11, 2016 10:21:04 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Server number: 7.0.68.0 五月 11, 2016 10:21:04 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: OS Name: Windows 7 五月 11, 2016 10:21:04 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: OS Version: 6.1 五月 11, 2016 10:21:04 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Architecture: amd64 五月 11, 2016 10:21:04 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Java Home: D:\Java_Study\Java\jdk1.7.0_79\jre 五月 11, 2016 10:21:04 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: JVM Version: 1.7.0_79-b15 五月 11, 2016 10:21:04 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: JVM Vendor: Oracle Corporation 五月 11, 2016 10:21:04 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: CATALINA_BASE: D:\Java_Study\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0 五月 11, 2016 10:21:04 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: CATALINA_HOME: D:\Java_Study\apache-tomcat-7.0.68 五月 11, 2016 10:21:04 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Dcatalina.base=D:\Java_Study\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0 五月 11, 2016 10:21:04 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Dcatalina.home=D:\Java_Study\apache-tomcat-7.0.68 五月 11, 2016 10:21:04 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Dwtp.deploy=D:\Java_Study\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\webapps 五月 11, 2016 10:21:04 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Djava.endorsed.dirs=D:\Java_Study\apache-tomcat-7.0.68\endorsed 五月 11, 2016 10:21:04 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Dfile.encoding=UTF-8 五月 11, 2016 10:21:04 下午 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.7.0_79\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;D:/Java_Study/Java/jdk1.7.0_79/bin/../jre/bin/server;D:/Java_Study/Java/jdk1.7.0_79/bin/../jre/bin;D:/Java_Study/Java/jdk1.7.0_79/bin/../jre/lib/amd64;D:\Java_Study\Java\jdk1.7.0_79\bin;D:\Java_Study\Java\jdk1.7.0_79\jre\bin;D:\Java_Study\mysql-5.7.12-winx64\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\100\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\120\Tools\Binn\;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files (x86)\nodejs\;D:\Java_Study\apache-maven-3.3.9\bin;C:\Users\Administrator\AppData\Roaming\npm;D:\Java_Study\eclipse;;. 五月 11, 2016 10:21:04 下午 org.apache.coyote.AbstractProtocol init 信息: Initializing ProtocolHandler ["http-bio-8080"] 五月 11, 2016 10:21:04 下午 org.apache.coyote.AbstractProtocol init 信息: Initializing ProtocolHandler ["ajp-bio-8009"] 五月 11, 2016 10:21:04 下午 org.apache.catalina.startup.Catalina load 信息: Initialization processed in 363 ms 五月 11, 2016 10:21:04 下午 org.apache.catalina.core.StandardService startInternal 信息: Starting service Catalina 五月 11, 2016 10:21:04 下午 org.apache.catalina.core.StandardEngine startInternal 信息: Starting Servlet Engine: Apache Tomcat/7.0.68 五月 11, 2016 10:21:05 下午 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:122) at java.util.concurrent.FutureTask.get(FutureTask.java:188) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1120) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:819) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1572) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1562) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) 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:153) ... 6 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:293) at org.apache.catalina.startup.ContextConfig.processAnnotationWebServlet(ContextConfig.java:2462) at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2137) at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2098) at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2090) at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2090) at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2090) at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1304) at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:889) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:386) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5472) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) ... 6 more 五月 11, 2016 10:21:05 下午 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:122) at java.util.concurrent.FutureTask.get(FutureTask.java:188) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1120) at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:300) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) at org.apache.catalina.core.StandardService.startInternal(StandardService.java:444) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:738) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) at org.apache.catalina.startup.Catalina.start(Catalina.java:693) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:428) Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1572) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1562) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Caused by: org.apache.catalina.LifecycleException: A child container failed during start at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1128) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:819) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) ... 6 more 五月 11, 2016 10:21:05 下午 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[8005]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153) at org.apache.catalina.startup.Catalina.start(Catalina.java:693) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:428) Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Catalina]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153) at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:738) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) ... 7 more Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153) at org.apache.catalina.core.StandardService.startInternal(StandardService.java:444) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) ... 9 more Caused by: org.apache.catalina.LifecycleException: A child container failed during start at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1128) at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:300) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) ... 11 more 五月 11, 2016 10:21:05 下午 org.apache.coyote.AbstractProtocol pause 信息: Pausing ProtocolHandler ["http-bio-8080"] 五月 11, 2016 10:21:05 下午 org.apache.coyote.AbstractProtocol pause 信息: Pausing ProtocolHandler ["ajp-bio-8009"] 五月 11, 2016 10:21:05 下午 org.apache.catalina.core.StandardService stopInternal 信息: Stopping service Catalina 五月 11, 2016 10:21:05 下午 org.apache.coyote.AbstractProtocol destroy 信息: Destroying ProtocolHandler ["http-bio-8080"] 五月 11, 2016 10:21:05 下午 org.apache.coyote.AbstractProtocol destroy 信息: Destroying ProtocolHandler ["ajp-bio-8009"]
找到:/WEB-INF/web.xml
1 <?xml version="1.0" encoding="UTF-8"?> 2 <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 3 xmlns="http://java.sun.com/xml/ns/javaee" 4 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" 5 id="WebApp_ID" version="3.0"> 6 <display-name>MyEL</display-name> 7 <welcome-file-list> 8 <welcome-file>default.jsp</welcome-file> 9 </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> 18 </web-app>
解决方案:
去掉其中的<servlet>标注信息
因为在Servlet类上边已经注解了servlet映射信息,所以不需要重复标注。
1 package com.dx.app; 2 3 import java.io.IOException; 4 5 import javax.servlet.RequestDispatcher; 6 import javax.servlet.ServletException; 7 import javax.servlet.annotation.WebServlet; 8 import javax.servlet.http.HttpServlet; 9 import javax.servlet.http.HttpServletRequest; 10 import javax.servlet.http.HttpServletResponse; 11 12 @WebServlet("/MyELServlet") 13 public class MyELServlet extends HttpServlet { 14 private static final long serialVersionUID = 1L; 15 16 protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 17 response.getWriter().append("Served at: ").append(request.getContextPath()); 18 request.setAttribute("Hello", "Hello Servlet!"); 19 // 请求转发: 20 // 1、调用HttpServletRequest 的getRequestDispatcher()的方法,获取RequestDispatcher对象 21 // 调用getRequestDispatcher()需要传入转发的地址。 22 String servletName="MyDispatcherServlet"; 23 RequestDispatcher requestDispatcher=request.getRequestDispatcher("/"+servletName); 24 25 // 2、调用HttpServletRequest的forward(request,response)方法。 26 requestDispatcher.forward(request, response); 27 } 28 }