java.lang.IllegalArgumentException:无效的<url-pattern> coreservlets.ShowItems_ArrayList </url-pattern>

时间:2015-04-09 09:27:31

标签: eclipse tomcat url-pattern

Eclipse版本:Kepler Service Release 1

构建ID:20130919-0819

  

到目前为止采取的步骤:

     

(1)删除了目录

中的.snap文件
<workspace-directory>\.metadata\.plugins\org.eclipse.core.resources
     

(2)删除了以下目录中的tmp文件夹

<workspace-directory>\.metadata\.plugins\org.eclipse.wst.server.core
     

(3)清洁项目&amp;服务器

     

(4)通过删除当前服务器重新配置服务器,&amp;加入   新服务器

     

(5)只是为了确保每次都重新启动Eclipse的更改   执行上述步骤后。

Caused by: java.lang.IllegalArgumentException: Invalid <url-pattern> coreservlets.ShowItems_ArrayList 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

然而,所有提示&amp;伎俩似乎徒劳无功。

web.xml文件:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
    version="3.0">

    <servlet>
        <servlet-name>ShowItems_ArrayList</servlet-name>
        <servlet-class>coreservlets.ShowItems_ArrayList</servlet-class>
    </servlet>


    <servlet-mapping>
        <servlet-name>ShowItems_ArrayList</servlet-name>
        <url-pattern>coreservlets.ShowItems_ArrayList</url-pattern>
    </servlet-mapping>

</web-app>

1 个答案:

答案 0 :(得分:0)

您的网址格式不正确。它需要以斜线开头。虽然不完全相同,但请看这个问题:

Why should url-pattern in servlet mapping start with forward slash(/)