Eclipse java.lang.IllegalArgumentException:名为[X]和[Y]的servlet都映射到不允许的url模式[/CreationClient]
我无法启动Tomcat:本地主机上的服务器Tomcat v7.0无法启动Eclipse java.lang.IllegalArgumentException:名为[X]和[Y]的servlet都映射到不允许的url模式[/CreationClient],eclipse,tomcat,Eclipse,Tomcat,我无法启动Tomcat:本地主机上的服务器Tomcat v7.0无法启动 Caused by: java.lang.IllegalArgumentException: The servlets named [CreationClient] and [com.sdz.tp.servlets.CreationClient] are both mapped to the url-pattern [/CreationClient] which is not permitted at org.ap
Caused by: java.lang.IllegalArgumentException: The servlets named [CreationClient] and [com.sdz.tp.servlets.CreationClient] are both mapped to the url-pattern [/CreationClient] which is not permitted
at org.apache.catalina.deploy.WebXml.addServletMapping(WebXml.java:335)
at org.apache.catalina.startup.ContextConfig.processAnnotationWebServlet(ContextConfig.java:2466)
at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2148)
at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2109)
at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2102)
at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2102)
at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2102)
at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2102)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1293)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:878)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:376)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5322)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 7 more
4 janv. 2014 19:57:38 org.apache.catalina.core.ContainerBase startInternal
问题可能出在我的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"
id="WebApp_ID" version="3.0">
<display-name>tp1</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>CreationClient</servlet-name>
<servlet-class>com.sdz.tp.servlets.CreationClient</servlet-class>
</servlet>
<servlet>
<servlet-name>CreationCommande</servlet-name>
<servlet-class>com.sdz.tp.servlets.CreationCommande</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>CreationClient</servlet-name>
<url-pattern>/CreationClient</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>CreationCommande</servlet-name>
<url-pattern>/CreationCommande</url-pattern>
</servlet-mapping>
</web-app>
tp1
index.html
index.htm
index.jsp
default.html
default.htm
default.jsp
创意客户
com.sdz.tp.servlets.CreationClient
创意司令部
com.sdz.tp.servlets.CreationCommande
创意客户
/创意客户
创意司令部
/创意司令部
有人能告诉我出了什么问题吗?尝试从类
com.sdz.tp.servlets.CreationClient
中删除@WebServlet
注释。servlet映射可以在web.xml
中定义,也可以使用注释来定义,但不能同时使用两者。尝试从类com.sdz.tp.servlets.CreationClient
中删除@WebServlet
注释。servlet映射可以在web.xml
中定义,也可以使用注释来定义,但不能同时使用两者。英语先生,您会说吗?抱歉@user3161023,尽管在创建该网站之前,有一个审批流程,关于堆栈溢出的问题和答案应该是英语的。是的,我会说一点…英语先生,你会说吗?抱歉@user3161023,虽然有一个审批过程,但在该网站创建之前,关于堆栈溢出的问题和答案应该是英语的。是的,我会说一点…谢谢。我试过了,但现在我有一个错误404!那就不同了。我建议你问一个新问题,并说明细节,例如,你正在呼叫哪个URL。我如何才能加入我项目的zip?你不能。您应该在问题文本中包含对问题有重要意义的代码部分。另请参见+1了解右侧ans dude:)谢谢。我试过了,但现在我有一个错误404!那就不同了。我建议你问一个新问题,并说明细节,例如,你正在呼叫哪个URL。我如何才能加入我项目的zip?你不能。您应该在问题文本中包含对问题有重要意义的代码部分。右ans dude:另见+1)