我通过支持Java EE的Eclipse运行tomcat,每当我尝试启动服务器时,都会出现以下错误,我无法运行任何servlet,
Mar 03, 2014 11:32:46 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
Mar 03, 2014 11:32:46 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:FirstServlet' did not find a matching property.
Mar 03, 2014 11:32:46 AM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-7010
Mar 03, 2014 11:32:46 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 575 ms
Mar 03, 2014 11:32:46 AM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Mar 03, 2014 11:32:46 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.39
Mar 03, 2014 11:32:46 AM org.apache.tomcat.util.digester.Digester endElement
SEVERE: End event threw exception
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl .java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.tomcat.util.IntrospectionUtils.callMethodN(IntrospectionUtils.jav a:959)
at org.apache.catalina.startup.CallMethodMultiRule.end(WebRuleSet.java:789)
at org.apache.tomcat.util.digester.Rule.end(Rule.java:229)
at org.apache.tomcat.util.digester.Digester.endElement(Digester.java:1158)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:606)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanE ndElement(XMLDocumentFragmentScannerImpl.java:1786)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$Fragm entContentDriver.next(XMLDocumentFragmentScannerImpl.java:2951)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocum entScannerImpl.java:606)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanD ocument(XMLDocumentFragmentScannerImpl.java:511)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Con figuration.java:846)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Con figuration.java:775)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:12 3)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractS AXParser.java:1210)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SA XParserImpl.java:628)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1675)
at org.apache.catalina.startup.ContextConfig.applicationWebConfig(ContextConfig .java:365)
at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:1045)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java: 265)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSuppor t.java:142)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4616)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:822)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.IllegalArgumentException: Servlet mapping specifies an unknown servlet name showconfi
at org.apache.catalina.core.StandardContext.addServletMapping(StandardContext.j ava:2743)
at org.apache.catalina.core.StandardContext.addServletMapping(StandardContext.j ava:2723)
... 37 more
Mar 03, 2014 11:32:46 AM org.apache.catalina.startup.ContextConfig applicationWe bConfig
SEVERE: Parse error in application web.xml file at jndi:/localhost/FirstServlet/WEB-INF/web.xml
org.xml.sax.SAXParseException; systemId: jndi:/localhost/FirstServlet/WEB-INF/web.xml;lineNumber: 53; columnNumber: 21; Error at (53, 21) : Servlet mapping specifies an unknown servlet name showconfi
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:606)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1786)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XM DocumentFragmentScannerImpl.java:2951)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmntScannerImpl.java:511)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:846)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:775)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1210)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:628)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1675)
at org.apache.catalina.startup.ContextConfig.applicationWebConfig(ContextConfig.java:365)
at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:1045)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:265)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4616)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:822)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.IllegalArgumentException: Servlet mapping specifies an unkn own servletname showconfi
at org.apache.catalina.core.StandardContext.addServletMapping(StandardContext.java:2743)
at org.apache.catalina.core.StandardContext.addServletMapping(StandardContext.java:2723)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.tomcat.util.IntrospectionUtils.callMethodN(IntrospectionUtils.java:959)
at org.apache.catalina.startup.CallMethodMultiRule.end(WebRuleSet.java:789)
at org.apache.tomcat.util.digester.Rule.end(Rule.java:229)
at org.apache.tomcat.util.digester.Digester.endElement(Digester.java:1158)
... 29 more
Mar 03, 2014 11:32:46 AM org.apache.catalina.startup.ContextConfig applicationWe bConfig
SEVERE: Occurred at line 53 column 21
Mar 03, 2014 11:32:46 AM org.apache.catalina.startup.ContextConfig start
SEVERE: Marking this application unavailable due to previous error(s)
Mar 03, 2014 11:32:46 AM org.apache.catalina.core.StandardContext start
SEVERE: Error getConfigured
Mar 03, 2014 11:32:46 AM org.apache.catalina.core.StandardContext start
SEVERE: Context [/FirstServlet] startup failed due to previous errors
Mar 03, 2014 11:32:46 AM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-7010
Mar 03, 2014 11:32:47 AM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:7011
Mar 03, 2014 11:32:47 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/32 config=null
Mar 03, 2014 11:32:47 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 582 ms
我的web.xml看起来像这样
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>FirstServlet</display-name>
<servlet>
<description></description>
<display-name>mygeco</display-name>
<servlet-name>mygeco</servlet-name>
<servlet-class>com.geco.highlight.mygeco</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>mygeco</servlet-name>
<url-pattern>/mygeco</url-pattern>
</servlet-mapping>
<servlet>
<description></description>
<display-name>upload</display-name>
<servlet-name>upload</servlet-name>
<servlet-class>com.geco.upload.upload</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>upload</servlet-name>
<url-pattern>/upload</url-pattern>
</servlet-mapping>
<servlet>
<description></description>
<display-name>show</display-name>
<servlet-name>show</servlet-name>
<servlet-class>com.geco.show.show</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>show</servlet-name>
<url-pattern>/show</url-pattern>
</servlet-mapping>
<servlet>
<description></description>
<display-name>mygeco1</display-name>
<servlet-name>mygeco1</servlet-name>
<servlet-class>com.geco.highlight1.mygeco1</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>mygeco1</servlet-name>
<url-pattern>/mygeco1</url-pattern>
</servlet-mapping>
<servlet>
<description></description>
<display-name>sconfi</display-name>
<servlet-name>sconfi</servlet-name>
<servlet-class>com.geco.sconfi.showconfi</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>showconfi</servlet-name>
<url-pattern>/showconfi</url-pattern>
</servlet-mapping>
答案 0 :(得分:0)
<servlet>
<description></description>
<display-name>sconfi</display-name>
<servlet-name>**sconfi**</servlet-name>
<servlet-class>com.geco.sconfi.showconfi</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>**showconfi**</servlet-name>
<url-pattern>/showconfi</url-pattern>
</servlet-mapping>
您需要使用相同的名称:
java.lang.IllegalArgumentException: Servlet mapping specifies an unknown servlet name showconfi