Bug 36284

Summary: External Entities cannot be found in web.xml
Product: Tomcat 5 Reporter: Paul Benedict <paul4christ79>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: P2    
Version: 5.0.28   
Target Milestone: ---   
Hardware: Other   
OS: All   

Description Paul Benedict 2005-08-20 06:25:03 UTC
I am using JspC to generated my precompiled pages, but I do not like how I am
forced to manually alter my web.xml. To get around this, I have declared an
external entity reference in web.xml:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app [
<!ENTITY foo SYSTEM "generated_web.xml">
]>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"... version="2.4">
....

When I reference the entity in the servlet section, I get an exception. Tomcat
is trying to resolve to the boot directory, not the directory of my webapp. This
is an obvious error:

======
java.io.FileNotFoundException: C:\jakarta-tomcat-5.0.28\bin\generated_web.xml
(The system cannot find the file specified)
	at java.io.FileInputStream.open(Native Method)
	at java.io.FileInputStream.<init>(FileInputStream.java:106)
	at java.io.FileInputStream.<init>(FileInputStream.java:66)
	at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:69)
	at
sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:156)
	at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
	at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source)
	at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source)
======

The XML parser should have a pluggable entity resolver that maps to the web
application directory being loaded.
Comment 1 william.barker 2005-08-20 21:31:36 UTC

*** This bug has been marked as a duplicate of 34034 ***