tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Sanders <>
Subject Re: [CATALINA]
Date Mon, 02 Apr 2001 23:15:54 GMT
Craig R. McClanahan wrote:

> On Mon, 2 Apr 2001, Scott Sanders wrote:
>> Using the latest CVS of Catalina, I am having an issue with my web 
>> application.  When I build my webapp with Ant, I create many xml files 
>> under WEB-INF/classes/xml/oem/*.  Then when a request comes in, I use 
>> getClass().getResource() to return the URL to the xml file.
>> In Tomcat 3.x (3.0,3.1,3.2,3.2.1), the URL returned looks something like 
>> file:///opt/tomcat/webapps/app-name/WEB-INF/classes/xml/oem/file.xml
>> In Catalina, the URL returned is:
>>    /WEB-INF/classes/xml/oem/file.xml
> Doesn't the actual URL returned have jndi: on the front?
Apologies, Craig the URL is:  jndi:/WEB-INF/classes/xml/oem/file.xml

the jndi: is on the front, that's what I get for looking at it in the 
debugger.  JBuilder is handy, but I just did not look deep enough. ;-)

>> The problem is when I use this URL as an InputSource to my XSLT 
>> processor (Saxon), which is contained in /WEB-INF/lib/saxon.jar, it says 
>> that it cannot find the file.  In Tomcat 3.x, it finds the file fine and 
>> continues processing.
> Could you provide a code snippet of exactly what you are trying?  I have
> used resources from /WEB-INF/classes and JAR files under /WEB-INF/lib with
> great success in Catalina, so it's probably something specific about what
> you are doing.

It looks as though a test using getClass.getResourceAsStream() works 
just fine.  I think that it is possible that Saxon is trying to do its 
own URL-processing and does not recognize the URL syntax starting with 
'jndi:'.  I will convert my code to use getResourceAsStream() instead.

Craig, thanks for the push in the right direction.  I probably should 
have thought about it more, as another service in the same webapp uses 
it without problems... ;-)

Scott Sanders

View raw message