正在学servlet我是跟着教程做的 没有 .html 跟 .jsp
整个项目其他的打开也全是404
篇幅有限 这是启动tomcat时报错
严重: End event threw exception
java.lang.reflect.InvocationTargetException
2015-4-27 17:40:48 org.apache.catalina.startup.ContextConfig applicationWebConfig
严重: Parse error in application web.xml file at jndi:/localhost/Servlet01/WEB-INF/web.xml
java.lang.IllegalArgumentException: Invalid <url-pattern> LoadEmpServlet in servlet mapping
at org.apache.tomcat.util.digester.Digester.createSAXException(Digester.java:2839)
at org.apache.tomcat.util.digester.Digester.createSAXException(Digester.java:2865)
at org.apache.tomcat.util.digester.Digester.endElement(Digester.java:1161)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782)
严重: Occurred at line 77 column 21
2015-4-27 17:40:48 org.apache.catalina.startup.ContextConfig start
严重: Marking this application unavailable due to previous error(s)
2015-4-27 17:40:48 org.apache.catalina.core.StandardContext start
严重: Error getConfigured
2015-4-27 17:40:48 org.apache.catalina.core.StandardContext start
严重: Context [/Servlet01] startup failed due to previous errors
2015-4-27 17:40:48 org.apache.catalina.startup.HostConfig deployDirectory
解决办法
看上面的错误信息就知道是Servlet01项目里面的web.xml配置有问题
也就是这行
严重: Parse error in application web.xml file at jndi:/localhost/Servlet01/WEB-INF/web.xml
再看这行
java.lang.IllegalArgumentException: Invalid <url-pattern> LoadEmpServlet in servlet mapping
说web.xml里面的LoadEmpServlet 类那块配置有问题,检查url-pattern附近的xml配置就能解决