You're still going to run into problems when you try to use message
resources (used prolifically for internal messages).  Struts
PropertyMessageResources calls getResourceAsStream() like this:

is = this.getClass().getClassLoader().getResourceAsStream(name);

...and if you look at the Orion classloader, it does not implement
getResourceAsStream().

This is what produces the "Cannot find message resources under
org.apache.struts.action.MESSAGE" error.  Look through the struts code
for the source of that message; it has nothing to do with loading the
dtds.


The change described below is not necessary on Orion 1.4.5 or 1.4.7 (the
only versions I have tested struts on).  My current struts code has
this.getClass().getResource(), and I see on the Orion console the
correct Digester registration methods for the dtds.
this.getClass().getClassLoader().getResource() is returning the correct
thing.

...browsing the (decompiled) source, it is amusing to note that the
Orion ServletContext (com.evermind.server.http.HttpApplication) does
implement getResourceAsStream(), but from the Struts
PropertyMessageResources you do not have access to the servlet context
so it's no use :-)

Jeff

>-----Original Message-----
>From: Tim Endres [mailto:[EMAIL PROTECTED]]
>Sent: Monday, March 05, 2001 11:50 AM
>To: Orion-Interest
>Subject: RE: classloader does not implement getResourceAsStream ?
>
>
>> This line (about line 881 in my version):
>> URL url = this.getClass().getResource(registrations[i+1]);
>> 
>> Must be replaced by this:
>> URL url = getServletContext().getResource(registrations[i+1]);
>
>Gee, that makes it look like a bug in Struts, as opposed to the
>reported bug in Orion. I believe that your patch is considered
>the "valid" way to get a resource in a J2EE servlet environment,
>is it not?
>
>tim.
>
>
>

Reply via email to