DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=30225>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=30225

<resource-ref> not properly parsed

           Summary: <resource-ref> not properly parsed
           Product: Tomcat 4
           Version: 4.1.30
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: Blocker
          Priority: Other
         Component: Servlet & JSP API
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


When a corresponding resource is not defined in a server.xml, the following 
web.xml segment:

<web-app>
  <resource-ref>
    <res-ref-name>jdbc/test</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
  </resource-ref>
 ...
</web-app>

Generates the following SAX parser error:

Jul 20, 2004 9:58:55 PM org.apache.coyote.http11.Http11Protocol init INFO: 
Initializing Coyote HTTP/1.1 on port 8080 Starting service Tomcat-Standalone 
Apache Tomcat/4.1.30 Jul 20, 2004 9:58:57 PM 
org.apache.commons.digester.Digester error SEVERE: Parse Error at line 72 
column 11: The content of element type "web-app" must match "(icon?,display-
name?,description?,distributable?,context-param*,filter*,filter-
mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-
mapping*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-
ref*,security-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-
local-ref*)". org.xml.sax.SAXParseException: The content of element type "web-
app" must match "(icon?,display-name?,description?,distributable?,context-
param*,filter*,filter-mapping*,listener*,servlet*,servlet-mapping*,session-
config?,mime-mapping*,welcome-file-list?,error-page*,taglib*,resource-env-
ref*,resource-ref*,security-constraint*,login-config?,security-role*,env-
entry*,ejb-ref*,ejb-local-ref*)".  at 
org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown 
Source)  at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)  
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)  at 
org.apache.xerces.impl.XMLErrorReporter.reportError(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 ...

This is a "blocker" for the following use case: You create a .war containing a 
servlet which first attempts to locate a DataSource. If a DataSource is not 
found (null returned), then the servlet uses a jdbc URL, username, and 
password specified via servlet init parameters to attempt a "default" 
DriverManager connection. Because the parse fails on the last line (the </web-
app> element), all the init parameters are read as null -- that is, opening 
via a default jdbc URL also fails.

This bug makes it virtually impossible to create a "commercial" .war that can 
run on any app server. Instead one has to eliminate the <resource-ref>, have 
the customer unpack the .war and edit the web.xml with appropriate URL, etc. 
for their computer.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to