org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]] ... ... Caused by: java.lang.IllegalArgumentException: The servlets named [loginServlet] and [login] are both mapped to the url-pattern [/login] which is not permitted
原因:是你写了两个 URL
到了同一个 Servlet
了,意思就是你配置了两个 URL
了,你需要删掉一个。比如你在 web.xml
里配置了一次,又用注解配置了一次,那就是两次了。
解决:只需要取其中一种就可以了。
提示:
比如你的 web.xml
里已经配置过了,你又用注解配了下面这种方式:
@WebServlet("/login")
其实是会报错的,我感觉你是想配置成这样:
@WebServlet(name = "/login")
哈哈哈!