java web程序中web.xml文件中servlet-name、url-pattern的值不能与映射的类名一致,否则tomcat启动不了,报错误: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/Servlet_day02]]

     新建一个web程序Servlet_day02新建一个ServletDemo1类继承HttpServlet,然后配置web.xml:

启动tomcat,一直报错:

 

  

 

报的错误是:Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/Servlet_day02]],

Caused by: java.lang.IllegalArgumentException: The servlets named [ServletDemo1] and [com.guan.servlet.ServletDemo1] are both mapped to the url-pattern [/ServletDemo1] which is not permitted

 

说明:servlet-name与url-pattern不能都与映射的类文件名相同。修改之:

 

 

启动tomcat,成功。

posted @ 2016-02-25 15:44  坚哥威武  阅读(977)  评论(0编辑  收藏  举报