eclipse中启动Tomcat7 server失败Caused by: java.lang.IllegalArgumentException: The servlets named...

来源:互联网 发布:mac os 快压 知乎 编辑:程序博客网 时间:2024/05/27 06:51
Caused by: java.lang.IllegalArgumentException: The servlets named [ServletDemo] and [day05.ServletDemo] are both mapped to the url-pattern [/ServletDemo] which is not permitted

应该是 /ServletDemo 一个请求映射了 [ServletDemo] and [day05.ServletDemo] 两个servlet 


找到原因了

是因为在类定义上面:

@WebServlet("/ServletDemo")//这里
public class ServletDemo extends HttpServlet {


不需要再在web.xml中定义servlet属性了。

0 0