Tomcat启动报错:
java.lang.IllegalArgumentException: Invalid <url-pattern> 严重: End event threw exception java.lang.reflect.InvocationTargetException at sun.reflect.GeneratedMethodAccessor18.invoke(Unknown Source) …… Caused by: java.lang.IllegalArgumentException: Invalid <url-pattern> servlet/item/ShowAddItemServlet in servlet mapping 严重: Parse error in application web.xml file at jndi:/localhost/drp3.6/WEB-INF/web.xml java.lang.IllegalArgumentException: Invalid <url-pattern> servlet/item/ShowAddItemServlet in servlet mapping at org.apache.tomcat.util.digester.Digester.createSAXException(Digester.java:2806) ……
错误原因:非法的<url-pattern>表达式
应将<url-pattern> servlet/item/ShowAddItemServlet
改为:<url-pattern> /servlet/item/ShowAddItemServlet
即如果有虚拟的文件夹,那么文件夹前要加斜杠“/”
<servlet-mapping> <servlet-name>spring</servlet-name> <url-pattern>*.do</url-pattern>//这里不要前面的 '/' </servlet-mapping>