Bug 36284 - External Entities cannot be found in web.xml
External Entities cannot be found in web.xml
Status: RESOLVED DUPLICATE of bug 34034
Product: Tomcat 5
Classification: Unclassified
Component: Catalina
5.0.28
Other All
: P2 normal (vote)
: ---
Assigned To: Tomcat Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2005-08-20 06:25 UTC by Paul Benedict
Modified: 2005-08-20 13:31 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
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 ***