名为 [create_subscription] 和 [servlet.create] 的 servlet 都映射到不允许的 url-pattern [/create] [英] The servlets named [create_subscription] and [servlet.create] are both mapped to the url-pattern [/create] which is not permitted

查看:36
本文介绍了名为 [create_subscription] 和 [servlet.create] 的 servlet 都映射到不允许的 url-pattern [/create]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 JDK 7 中使用 Tomcat 7 和 Eclipse 来创建这个简单的 servlet 应用程序.但是当我将war文件复制到tomcat中时,我无法启动它并出现此错误:

<块引用><块引用>

名为 [create_subscription] 和 [servlet.create] 的 servlet 都映射到不允许的 url-pattern [/create]

web.xml 是:

<display-name>CC</display-name><欢迎文件列表><welcome-file>index.html</welcome-file><welcome-file>index.htm</welcome-file><welcome-file>index.jsp</welcome-file><welcome-file>default.html</welcome-file><welcome-file>default.htm</welcome-file><welcome-file>default.jsp</welcome-file></welcome-file-list><小服务程序><servlet-name>create_subscription</servlet-name><servlet-class>servlet.create</servlet-class><servlet-mapping><servlet-name>create_subscription</servlet-name><url-pattern>/create</url-pattern></servlet-mapping></web-app>

解决方案

如果您在 web.xml 和注释中声明了相同的映射,那么在更高版本的 Tomcat 中您将得到这个精确的错误.

I am using Tomcat 7 and Eclipse in JDK 7 to create this simple servlet application. But when I copied the war file into tomcat, I cannot start it and get this error:

The servlets named [create_subscription] and [servlet.create] are both mapped to the url-pattern [/create] which is not permitted

the web.xml is:

<?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" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>CC</display-name>
  <welcome-file-list>
  <welcome-file>index.html</welcome-file>
  <welcome-file>index.htm</welcome-file>
  <welcome-file>index.jsp</welcome-file>
  <welcome-file>default.html</welcome-file>
  <welcome-file>default.htm</welcome-file>
  <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>

<servlet>
  <servlet-name>create_subscription</servlet-name>
  <servlet-class>servlet.create</servlet-class>
</servlet>

<servlet-mapping>
  <servlet-name>create_subscription</servlet-name>
  <url-pattern>/create</url-pattern>
</servlet-mapping>

</web-app>

解决方案

If you have the same mapping declared in both web.xml and in an annotation, you will get this precise error with later versions of Tomcat.

这篇关于名为 [create_subscription] 和 [servlet.create] 的 servlet 都映射到不允许的 url-pattern [/create]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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