tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 24965] New: - IllegalArgumentException during parsing of web.xml
Date Tue, 25 Nov 2003 09:02:16 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24965>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24965

IllegalArgumentException during parsing of web.xml

           Summary: IllegalArgumentException during parsing of web.xml
           Product: Tomcat 5
           Version: 5.0.14
          Platform: All
               URL: http://www.mail-archive.com/tomcat-
                    dev@jakarta.apache.org/msg49455.html
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: florent.benoit@objectweb.org


No answer on mailing list, so create the bug.

With the new 2.4 schema for servlets, there is not anymore a strict order for
the top level elements in the web.xml file

So we can declare a servlet and then its mapping, and then a new servlet with
its mapping
Something like that :

<servlet> ...servletA..</servlet>
<servlet-mapping>..servletA...</servlet-mapping>
<servlet> ...servletB..</servlet>
<servlet-mapping>..servletB...</servlet-mapping>


But the mapping of a servlet can be declared before the declaration of the
servlet element. (with 2.4 schema)

<servlet-mapping>..servletA...</servlet-mapping>
<servlet> ...servletA..</servlet>



The problem is that this is a valid XML but it fails during the deployment on 
Tomcat 5.
This is due to the fact that during the XML parsing, when we add a servlet
mapping, there is a check to see if the servlet exists.

Note that the xml validation is turned on.

The problem come from the method addServletMapping() in
org.apache.catalina.core.StandardContext class.

// Validate the proposed mapping
       if (findChild(name) == null)
           throw new IllegalArgumentException
               (sm.getString("standardContext.servletMap.name", name));

Maybe the check has to move to another place.

At runtime it gives this trace when deploying the war :

ContextConfig.applicationConfig : Parse error in application web.xml
java.lang.IllegalArgumentException: Servlet mapping specifies an unknown servlet
name Test
        at
org.apache.commons.digester.Digester.createSAXException(Digester.java:2540)
        at
org.apache.commons.digester.Digester.createSAXException(Digester.java:2566)
        at org.apache.commons.digester.Digester.endElement(Digester.java:1061)
        at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
        at org.apache.xerces.impl.xs.XMLSchemaValidator.endElement(Unknown Source)
        at
org.apache.xerces.impl.XMLNSDocumentScannerImpl.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.DTDConfiguration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.commons.digester.Digester.parse(Digester.java:1548)
        at
org.apache.catalina.startup.ContextConfig.applicationConfig(ContextConfig.java:305)
        at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:748)
        at
org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:257)
        at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.ja

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message