Tomcat 7:无效映射(java.lang.IllegalArgumentException) [英] Tomcat 7: Invalid mapping (java.lang.IllegalArgumentException)

查看:51
本文介绍了Tomcat 7:无效映射(java.lang.IllegalArgumentException)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将现有项目从 Tomcat 6 迁移到 7.在启动时我遇到此记录的错误消息:

I am migrating an existing project from Tomcat 6 to 7. Upon startup I am encountering this logged error message:

Jul 02, 2013 2:38:39 PM org.apache.catalina.startup.ContextConfig parseWebXml
SEVERE: Parse error in application web.xml file at jndi:/localhost/padd/WEB-INF/web.xml
org.xml.sax.SAXParseException; systemId: jndi:/localhost/padd/WEB-INF/web.xml; lineNumber: 309; columnNumber: 21; Error at (309, 21) : The servlets named [ArtefactServlet] and [saveArtefactServlet] are both mapped to the url-pattern [/saveRestoration] which is not permitted
    at org.apache.tomcat.util.digester.Digester.createSAXException(Digester.java:2687)
    ...
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalArgumentException: The servlets named [ArtefactServlet] and [saveArtefactServlet] are both mapped to the url-pattern [/saveRestoration] which is not permitted

这里是 WEB-INF/web.xml 行 309fff:

Here the WEB-INF/web.xml line 309fff:

  <servlet-mapping>
    <servlet-name>saveArtefactServlet</servlet-name>
    <url-pattern>/saveRestoration</url-pattern>
  </servlet-mapping>

  <servlet-mapping>
    <servlet-name>ArtefactServlet</servlet-name>
    <url-pattern>/saveRestoration</url-pattern>
  </servlet-mapping>

这里tomcat的web.xml:

<servlet-mapping>
        <servlet-name>default</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>

    <!-- The mappings for the JSP servlet -->
    <servlet-mapping>
        <servlet-name>jsp</servlet-name>
        <url-pattern>*.jsp</url-pattern>
        <url-pattern>*.jspx</url-pattern>
    </servlet-mapping>

我尝试使用映射,但无法取得任何进展.希望能帮到你!

I tried to play around with the mapping, but couldn't make any progress. Hope you can help!

推荐答案

错误提示:

名为 [ArtefactServlet] 和 [saveArtefactServlet] 的 servlet 是都映射到 url-pattern [/saveRestoration] 这不是允许

The servlets named [ArtefactServlet] and [saveArtefactServlet] are both mapped to the url-pattern [/saveRestoration] which is not permitted

所以当你的 url 模式匹配时,tomcat 不知道要调用哪个 servlet.为这两个 servlet ArtefactServletsaveArtefactServlet

So tomcat doesn't know which servlet to be called when your url pattern is matched. Give different url patterns for these two servlets ArtefactServlet, saveArtefactServlet

这篇关于Tomcat 7:无效映射(java.lang.IllegalArgumentException)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆