【发布时间】:2015-06-14 14:14:00
【问题描述】:
Eclipse 版本:Kepler Service Release 1
版本号:20130919-0819
目前采取的步骤:
(1) 删除目录下的.snap文件
<workspace-directory>\.metadata\.plugins\org.eclipse.core.resources(2) 删除了以下目录中的tmp文件夹
<workspace-directory>\.metadata\.plugins\org.eclipse.wst.server.core(3) 清理项目和服务器
(4) 通过删除当前服务器重新配置服务器,并添加 新服务器
(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
但是,所有提示和技巧似乎都徒劳无功。
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>
【问题讨论】:
-
似乎问题出在
Invalid <url-pattern>上。你能把你的 web.xml 贴在这里吗? -
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 </servletclass> </servlet> <servlet-mapping> <servlet-name>ShowItems_ArrayList</servlet-name> <url-pattern>coreservlets.ShowItems_ArrayList</url-pattern> </servlet-mapping> </web-app> -
@kucing_terbang -
web.xml file is attached per your request. -
好吧,你可以通过添加斜杠来更改 url 模式(就像 Necreaux 发布的那样)
标签: eclipse tomcat url-pattern