java.lang.IllegalArgumentException:无效的<url-pattern>在servlet映射中生成</url-pattern>

时间:2014-12-28 13:39:11

标签: tomcat servlets

我按照此问题解决方案The superclass “javax.servlet.http.HttpServlet” was not found on the Java Build Path运行Tomcat服务器时出现此异常:

SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/stpt-e]]
    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:1123)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:799)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    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: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/stpt-e]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    ... 6 more
Caused by: java.lang.IllegalArgumentException: Invalid <url-pattern> generate in servlet mapping
    at org.apache.catalina.core.StandardContext.addServletMapping(StandardContext.java:3279)
    at org.apache.catalina.core.StandardContext.addServletMapping(StandardContext.java:3254)
    at org.apache.catalina.deploy.WebXml.configureContext(WebXml.java:1430)
    at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1344)
    at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:876)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:374)
    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:5355)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ... 6 more

这是如何引起的?如何解决?

1 个答案:

答案 0 :(得分:0)

我创建了generate.java servlet,但在该servlet中,我将此代码@WebServlet("/generate")更改为@WebServlet("generate")