Tomcat启动报错Server Tomcat v8.5 Server at localhost failed to start

Posted 一切因为是码农

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Tomcat启动报错Server Tomcat v8.5 Server at localhost failed to start相关的知识,希望对你有一定的参考价值。

报错信息:

在这里插入图片描述

五月 28, 2021 5:17:10 下午 org.apache.catalina.startup.Catalina start
严重: 所必需的服务组件启动失败,所以无法启动Tomcat
org.apache.catalina.LifecycleException: 子容器启动失败
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:942)
	at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:766)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:688)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:342)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:473)
Caused by: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: 子容器启动失败
	at java.util.concurrent.FutureTask.report(Unknown Source)
	at java.util.concurrent.FutureTask.get(Unknown Source)
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:931)
	... 13 more
Caused by: org.apache.catalina.LifecycleException: 子容器启动失败
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:942)
	at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:827)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1412)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1402)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: 无法启动组件[StandardEngine[Catalina].StandardHost[localhost].StandardContext[/day1]]
	at java.util.concurrent.FutureTask.report(Unknown Source)
	at java.util.concurrent.FutureTask.get(Unknown Source)
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:931)
	... 8 more
Caused by: org.apache.catalina.LifecycleException: 无法启动组件[StandardEngine[Catalina].StandardHost[localhost].StandardContext[/day1]]
	at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)
	... 6 more
Caused by: java.lang.IllegalArgumentException: servlet映射中的<url pattern>[myservlet]无效
	at org.apache.catalina.core.StandardContext.addServletMappingDecoded(StandardContext.java:3189)
	at org.apache.catalina.core.StandardContext.addServletMappingDecoded(StandardContext.java:3176)
	at org.apache.catalina.startup.ContextConfig.configureContext(ContextConfig.java:1338)
	at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1115)
	at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:779)
	at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:299)
	at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5066)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	... 6 more

五月 28, 2021 5:17:10 下午 org.apache.coyote.AbstractProtocol pause
信息: 暂停ProtocolHandler["http-nio-8080"]
五月 28, 2021 5:17:10 下午 org.apache.catalina.core.StandardService stopInternal
信息: 正在停止服务[Catalina]
五月 28, 2021 5:17:10 下午 org.apache.coyote.AbstractProtocol destroy
信息: 正在摧毁协议处理器 ["http-nio-8080"]

解决办法:

在这里插入图片描述
我们查看报错信息中Caused by java.lang.IllegalArgumentException这一行
提示servlet映射中的[myservlet]无效

我们查看下源代码:
在这里插入图片描述
可以看到这个地方少了个“\\”,这属实是马虎哈
再给他添加进去,重新启动servlet
在这里插入图片描述
此时问题解决


问题总结:

在这里插入图片描述
(此处参考博客: Yeomer

以上是关于Tomcat启动报错Server Tomcat v8.5 Server at localhost failed to start的主要内容,如果未能解决你的问题,请参考以下文章

Tomcat启动报错:SERVER: Error ListenerStart 排查过程记录

Tomcat启动报错Server Tomcat v8.5 Server at localhost failed to start

maven项目使用tomcat启动报错:Server Tomcat v8.5 Server at localhost failed to start

Eclipse启动tomcat时出现报错

tomcat启动报错了,求教高手解答

为啥我的Tomcat启动时总是报错