当我尝试在我的项目中执行某些文件时,我收到此错误
" localhost上的服务器Tomcat v7.0服务器无法启动"
控制台显示以下错误
Caused by: java.lang.IllegalArgumentException: The servlets named [AdminValidate] and [com.kunal.servlet.AdminValidate] are both mapped to the url-pattern [/AdminValidate] which is not permitted
at org.apache.catalina.deploy.WebXml.addServletMapping(WebXml.java:293)
at org.apache.catalina.startup.ContextConfig.processAnnotationWebServlet(ContextConfig.java:2396)
at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2072)
at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2033)
at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2026)
at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2026)
at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2026)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1291)
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:5378)
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" id="WebApp_ID" version="3.0">
<display-name>Agro</display-name>
<servlet>
<display-name>AdminValidate</display-name>
<servlet-name>AdminValidate</servlet-name>
<servlet-class>com.kunal.servlet.AdminValidate</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>AdminValidate</servlet-name>
<url-pattern>/AdminValidate</url-pattern>
</servlet-mapping>
<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>
</web-app>
我在stackoverflow上尝试了所有解决方案,但似乎没有任何帮助...如果有任何其他解决方案,请在此处发布。
答案 0 :(得分:0)
评论提供了答案,我仍希望将其作为答案发布
Caused by: java.lang.IllegalArgumentException: The servlets named [AdminValidate] and [com.kunal.servlet.AdminValidate] are both mapped to the url-pattern [/AdminValidate] which is not permitted
当您为同一个URL模式提供了多个servlet时,您希望容器为URL选择一个servlet?
请检查web.xml以查找映射到相同URL模式的多个servlet。
思考。