Mike,

The format you are using looks right to me.

Are you deploying your servlet in the default web app? If so, try deploying
it an a custom web app...

The reason I say this is that I noticed earlier on that the default web
app's context seems to be a bit "weird", I suspect it may be broken, as I
got a IllegalStateException calling context.getRealPath() (from memory). I
haven't had a chance to investigate it properly yet, too busy finding all
the other JRun 3.0 bugs... :-)

Perhaps you could post the entire stack trace, that might help a bit.

cheers

geoff

----- Original Message -----
From: "Scott Stirling" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, August 08, 2000 3:48 PM
Subject: RE: getResourceAsStream()


> I haven't tried this for your particular case, Mike, but the default root
for
> all web applications under a JRun server is the server's root directory.
So if
> you just specify a file name, JRun will look in
JRUN_HOME/servers/servername/
> for that file.  I have no idea if this is kosher according to any spec.,
but it
> might work.  Obviously this blows portability for resources you'd want to
bundle
> into a war file, but that's another problem.  Maybe you or one of the
other
> engineers on this list has some comments on how this ought to work
according to
> the spec?
>
> Scott Stirling
>
> > -----Original Message-----
> > From: Mike Hogarth [mailto:[EMAIL PROTECTED]]
> > Sent: Sunday, August 06, 2000 5:22 AM
> > To: [EMAIL PROTECTED]
> > Subject: getResourceAsStream()
> >
> >
> > Anyone know the path + actual directory that is required in order to
> > load a .war resource using getResourceAsStream()?
> >
> > This works with JRun 3.0 (this is the pre-war way of doing things):
> > InputStream is_xsl =
> > this.getClass().getClassLoader().getResourceAsStream("edu/ucd/guidelin
> > es/Headache.xsl");
> >
> > The new API allows the following, but I keep getting a
NullPointerException:
> > ServletContext sc = this.getServletConfig().getServletContext();
> > InputStream is_xml = sc.getResourceAsStream("/guidelines/Headache.xml");
> >
> > I know the ServletContext is being obtained correctly as other
> > methods in ServletContext work fine.  I figure it has to be the path
> > format for the resource.
> >
> > I have the document within the following directory structure:
> >
> > /WEB-INF
> > /guidelines
> > Headache.xml
> >
> > Wonder if the path name I'm using with getResourceAsStream() is not
> > in the correct format. Can't seem to find a mention of the right
> > format anywhere.
> >  I assume that others have successfully used this method with JR3.
> >
> > Thanks in advance,
> > Mike H
>
> --------------------------------------------------------------------------
----
> Archives: http://www.egroups.com/group/jrun-interest/
> Unsubscribe:
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/jrun_talk
> or send a message to [EMAIL PROTECTED] with
'unsubscribe' in the body.
>

------------------------------------------------------------------------------
Archives: http://www.egroups.com/group/jrun-interest/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/jrun_talk
or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the 
body.

Reply via email to