Tomcat启动报 End event threw exception等错误,改如何解决?我在一个工程的web.xml中加入如下初始化参数,
Tomcat启动报 End event threw exception等错误,改如何解决?
我在一个工程的web.xml中加入如下初始化参数,启动Tomcat会报错,我用的Tomcat版本为Tomcat6.0.20
web.xml:(引起错误的代码,因为只有删掉这些代码才不会报错了,仅把其中<init-param>部分删掉也
能解决问题);
XML code<servlet> <servlet-name>CreateDBServlet</servlet-name> <servlet-class>org.sunxin.cho4.servlet.CreateDBServlet</servlet-class> <init-param> <param-name>driverClass</param-name> <param-value>com.mysql.jdbc.Driver</param-value> </init-param> <init-param> <param-name>url</param-name> <param-value>jdbc:mysql://localhost:3306</param-value> </init-param> <init-param> <param-name>user</param-name> <param-value>root</param-value> </init-param> <init-param> <param-name>password</param-name> <param-value>123</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>CreateDBServlet</servlet-name> <servlet-pattern>/CreateDB</servlet-pattern> </servlet-mapping>
Tomcat报的错误:
第一个错误;
2010-1-23 20:14:03 org.apache.tomcat.util.digester.Digester endElement
严重: End event threw exception
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tomcat.util.IntrospectionUtils.callMethodN(IntrospectionUt
ils.java:956)
at org.apache.catalina.startup.CallMethodMultiRule.end(WebRuleSet.java:7
75)
at org.apache.tomcat.util.digester.Rule.end(Rule.java:229)
at org.apache.tomcat.util.digester.Digester.endElement(Digester.java:114
0)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endEleme
nt(AbstractSAXParser.java:601)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp
l.scanEndElement(XMLDocumentFragmentScannerImpl.java:1774)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp
l$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2930)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(X
MLDocumentScannerImpl.java:648)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp
l.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(X
ML11Configuration.java:807)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(X
ML11Configuration.java:737)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.
java:107)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Ab
stractSAXParser.java:1205)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.p
arse(SAXParserImpl.java:522)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1644)
at org.apache.catalina.startup.ContextConfig.applicationWebConfig(Contex
tConfig.java:365)
at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:10
66)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfi
第二个错误;
Caused by: java.lang.IllegalArgumentException: Invalid <url-pattern> null in ser
vlet mapping
at org.apache.catalina.core.StandardContext.addServletMapping(StandardCo
ntext.java:2474)
at org.apache.catalina.core.StandardContext.addServletMapping(StandardCo
ntext.java:2450)
第三个错误
严重: Parse error in application web.xml file at jndi:/localhost/ch03/WEB-INF/we
b.xml
java.lang.IllegalArgumentException: Invalid <url-pattern> null in servlet mappin
g
at org.apache.tomcat.util.digester.Digester.createSAXException(Digester.
java:2808)
at org.apache.tomcat.util.digester.Digester.createSAXException(Digester.
java:2834)
at org.apache.tomcat.util.digester.Digester.endElement(Digester.java:114
3)
[解决办法]
<servlet-mapping>
<servlet-name>CreateDBServlet</servlet-name>
<servlet-pattern>/CreateDB</servlet-pattern>
</servlet-mapping>
<servlet-pattern>改成<url-pattern>
我的异常网推荐解决方案:Servlet.service() for servlet default threw exception,http://www.myexception.cn/eclipse/181756.html