码迷,mamicode.com
首页 > 其他好文 > 详细

servlet程序使用tomcat启动报错

时间:2017-03-24 13:17:10      阅读:287      评论:0      收藏:0      [点我收藏+]

标签:简单   startup   test   map   standard   fail   cat   extc   sed   

根据书上的需求写了一些简单的servlet代码,启动时报错:

 

严重: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/testagain]]
 at java.util.concurrent.FutureTask.report(FutureTask.java:122)
 at java.util.concurrent.FutureTask.get(FutureTask.java:192)
 at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:916)
 at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:868)
 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
 at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
 at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
 at java.util.concurrent.FutureTask.run(FutureTask.java:266)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
 at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/testagain]]
 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
 ... 6 more
Caused by: java.lang.IllegalArgumentException: Invalid <url-pattern> listbookservlet in servlet mapping
 at org.apache.catalina.core.StandardContext.addServletMapping(StandardContext.java:3150)
 at org.apache.catalina.core.StandardContext.addServletMapping(StandardContext.java:3125)
 at org.apache.catalina.startup.ContextConfig.configureContext(ContextConfig.java:1372)
 at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1176)
 at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:771)
 at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:305)
 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:5120)
 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
 ... 6 more

 

发现其中Caused by: java.lang.IllegalArgumentException: Invalid <url-pattern> listbookservlet in servlet mapping

说明servlet映射的url-pattern有问题。

我是用注解的方式写的servlet映射,应该将@WebServlet("cartservlet")写成@WebServlet("/cartservlet"),

这样问题就解决了。

servlet程序使用tomcat启动报错

标签:简单   startup   test   map   standard   fail   cat   extc   sed   

原文地址:http://www.cnblogs.com/xhj123/p/6610893.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!