servlet程序使用tomcat启动报错

根据书上的需求写了一些简单的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"),

这样问题就解决了。

时间: 2024-10-29 19:08:26

servlet程序使用tomcat启动报错的相关文章

Tomcat启动报错:严重: StandardServer.await: create[8005] java.net.BindException: Cannot assign requested address

org.apache.catalina.core.StandardServer await        SEVERE: StandardServer.await: create[8005]:        java.net.BindException: Cannot assign requested address java.net.BindException: Cannot assign requested address        at java.net.PlainSocketImpl

Tomcat启动报错[org.apache.struts2.dispatcher.Dispatcher]Dispatcher initialization failed

Tomcat启动报错: [org.apache.struts2.dispatcher.Dispatcher]Dispatcher initialization failed Unable to load configuration. - bean - jar:file:/E:/SoftwareDevelopment/Software/Eclipse4.3/eclipse-jee-kepler-SR1-win32-x86_64/Workspace/.metadata/.plugins/org.ec

Tomcat启动报错java.net.AbstractPlainSocketImpl(java/net/AbstractPlainSocketImpl.java:178:-1)Struts在网络复杂情况下启动报错解决办法

SSH项目 在网络复杂的情况(具体规律未知)下,Tomcat启动时,报如下错误: [ERROR] 2014-08-12 14:52:58,484 [org.apache.struts2.dispatcher.Dispatcher :27] - Dispatcher initialization failedUnable to load configuration. - Class: java.net.AbstractPlainSocketImplFile: AbstractPlainSocket

tomcat启动报错,找不到相应的 queue,从而引发内存泄漏

tomcat启动报错,无法创建 bean listenerStatusChangeDealHandler, no queue 'STOCK.NOTIFY_CHANGE.INTER.CACHE.QUEUE' in vhost 从启动日志来看,有时候仅会看到内存泄漏,而没有与queue相关的日志,非常easy走错方向. 依照 http://blog.csdn.net/wangjunjun2008/article/details/23375501 的方法能够看到具体日志,从而确定报错原因 tomcat

Tomcat启动报错org.springframework.web.context.ContextLoaderListener类配置错误——SHH框架

SHH框架工程,Tomcat启动报错org.springframework.web.context.ContextLoaderListener类配置错误 1.查看配置文件web.xml中是否配置.org.springframework.web.context.ContextLoaderListener在web.xml配置文件中已经配置 2.查看工程是否添加此jar包,org.springframework.web.context.ContextLoaderListener的jar包为spring

tomcat启动报错,找不到对应的 queue,从而引发内存泄漏

tomcat启动报错,无法创建 bean listenerStatusChangeDealHandler, no queue 'STOCK.NOTIFY_CHANGE.INTER.CACHE.QUEUE' in vhost 从启动日志来看,有时候仅会看到内存泄漏,而没有与queue相关的日志,很容易走错方向. 按照 http://blog.csdn.net/wangjunjun2008/article/details/23375501 的方法可以看到详细日志,从而确定报错原因 tomcat启动报

tomcat启动报错:java.net.BindException: Permission denied &lt;null&gt;:80

1,启动报错显示 [org.springframework.web.servlet.DispatcherServlet]FrameworkServlet 'springMvc': initialization completed in 382 ms Jun 01, 2015 6:39:06 PM org.apache.coyote.http11.Http11Protocol start SEVERE: Error starting endpoint java.net.BindException:

tomcat启动报错APR问题

背景 很多的生产环境项目都在使用tomcat,所以要经常的跟tomcat打交道,排错是家常便饭.本博文主要是是介绍关于tomcat启动时报APR错误,报错信息如下: 02-Aug-2017 18:13:00.769 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR  based Apache Tomcat Native library which allows optimal perf

windows tomcat 启动报错TOMCAT JAVA_HOME or JRE_HOME environment variable is not defined correctly

问题描述: TOMCAT JAVA_HOME or JRE_HOME environment variable is not defined correctly 报错信息如下:Neither the JAVA_HOME nor the JRE_HOME environment variable is defined At least one of these environment variable is needed to run this program;提示找不到java_home各jre