用eclipse新建servlet时的默认代码中有一句"@WebServlet("/该servlet的名字")",如果又在web.xml中配置该servlet,而且url-pattern项写的仍然是"/该servlet的名字",在tomcat部署运行时就会出现
"java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/项目]]…………"
的异常。
要么只在servlet中写@WebServlet("/该servlet的名字"),要么只在web.xml中配置servlet,这两个做法最好不要同时做。