报错信息:

在这里插入图片描述

五月 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

Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐