August 2, 2009

Servlet mapping specifies an unknown servlet

Topic:  Servlets 2.4

Application Server: JBoss 4.0.2

Exception:

ERROR [org.apache.catalina.startup.ContextConfig] Parse error in application web.xml
java.lang.IllegalArgumentException: Servlet mapping specifies an unknown servlet name hello
    at org.apache.tomcat.util.digester.Digester.createSAXException(Digester.java:2719)
    at org.apache.tomcat.util.digester.Digester.createSAXException(Digester.java:2745)
    at org.apache.tomcat.util.digester.Digester.endElement(Digester.java:1060)
    at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
    at org.apache.xerces.impl.dtd.XMLDTDValidator.endNamespaceScope(Unknown Source)
    at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source)
    at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.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:339)
    at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:1031)

Resolution:

This is a web.xml parse exception. Most probably, the <servlet-mapping> element has been put before the <servlet> element. Reverse the order of the 2 elements to make things work.

No comments:

Post a Comment