servlet配置问题
自己写了个servlet,结果一启动tomcat就出现一堆错误:
信息: Starting Servlet Engine: Apache Tomcat/5.5.20
2007-3-13 0:03:27 org.apache.catalina.core.StandardHost start
信息: XML validation disabled
2007-3-13 0:03:28 org.apache.tomcat.util.digester.Digester fatalError
严重: Parse Fatal Error at line 5 column 3: The markup in the document following the root element must be well-formed.
org.xml.sax.SAXParseException: The markup in the document following the root element must be well-formed.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$TrailingMiscDispatcher.dispatch(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1561)
at org.apache.catalina.startup.ContextConfig.applicationWebConfig(ContextConfig.java:351)
at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:1041)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:260)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4143)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
at org.apache.catalina.core.StandardService.start(StandardService.java:450)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
2007-3-13 0:03:28 org.apache.catalina.startup.ContextConfig applicationWebConfig
严重: Parse error in application web.xml file at jndi:/localhost/Servlet/WEB-INF/web.xml
org.xml.sax.SAXParseException: The markup in the document following the root element must be well-formed.
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1561)
at org.apache.catalina.startup.ContextConfig.applicationWebConfig(ContextConfig.java:351)
at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:1041)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:260)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4143)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
at org.apache.catalina.core.StandardService.start(StandardService.java:450)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
2007-3-13 0:03:28 org.apache.catalina.startup.ContextConfig applicationWebConfig
严重: Occurred at line 5 column 3
2007-3-13 0:03:28 org.apache.catalina.startup.ContextConfig start
严重: Marking this application unavailable due to previous error(s)
2007-3-13 0:03:28 org.apache.catalina.core.StandardContext start
严重: Error getConfigured
2007-3-13 0:03:28 org.apache.catalina.core.StandardContext start
严重: Context [/Servlet] startup failed due to previous errors
2007-3-13 0:03:31 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: contextInitialized()
2007-3-13 0:03:31 org.apache.catalina.core.ApplicationContext log
信息: SessionListener: contextInitialized()
2007-3-13 0:03:32 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: contextInitialized()
那位大虾指导一下啦~谢谢:P
[解决办法]
文件的物理路径和请求路径设置问题,说明你对配置文件的作用没什么概念,建议看一下配置文件方面的知识吧。
[解决办法]
<servlet>
<servlet-name> acceptServlet </servlet-name>
<servlet-class> acceptServlet </servlet-class> 这里要写上包 如:com.servlet.acceptServlet
</servlet>
<servlet-mapping>
<servlet-name> acceptServlet </servlet-name>
<url-pattern> /acceptServlet </url-pattern>
</servlet-mapping>
[解决办法]
同意PaulDeng198212,servlet-class要写上 包名的
[解决办法]
web.xml 文件中的元素配置不匹配,语法格式有问题, <servlet> ... </servlet> ,每个元素的定义必须匹配,请搂主检查一下,是不是这个原因.