You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by Jarek Gawor <jg...@gmail.com> on 2007/01/25 21:31:14 UTC

resource visibility

Hi,

I have a question on resource visibly to classloaders. Here's an
example. I have a following JSP page packaged in .war file. The JSP
tries to load some descriptors packaged in the war file in two
different ways. The question is should the fist method work?

The JSP does:

System.out.println(getClass().getResource("/WEB-INF/web.xml"));
    System.out.println(getServletConfig().getServletContext().getResource("/WEB-INF/web.xml"));

and first method returns null but second works as expected. Anybody
knows quick answer to this?

Thanks,
Jarek

Re: resource visibility

Posted by Jarek Gawor <jg...@gmail.com>.
I haven't tried precompiling the JSP but I see the same issue in
another case with servlet-based web services. The classloader of a
class loaded from a jar file (the jar file is in a war file) does not
see the war's WEB-INF/<foo> files. And I'm not sure if it should or
not.

Jarek

On 1/25/07, David Jencks <da...@yahoo.com> wrote:
> well.... getClass().getClassLoader() might possibly not be the
> applications classloader???  Do you get the same result if you
> precompile the jsp?
>
> thanks
> david jencks
>
> On Jan 25, 2007, at 12:31 PM, Jarek Gawor wrote:
>
> > Hi,
> >
> > I have a question on resource visibly to classloaders. Here's an
> > example. I have a following JSP page packaged in .war file. The JSP
> > tries to load some descriptors packaged in the war file in two
> > different ways. The question is should the fist method work?
> >
> > The JSP does:
> >
> > System.out.println(getClass().getResource("/WEB-INF/web.xml"));
> >    System.out.println(getServletConfig().getServletContext
> > ().getResource("/WEB-INF/web.xml"));
> >
> > and first method returns null but second works as expected. Anybody
> > knows quick answer to this?
> >
> > Thanks,
> > Jarek
>
>

Re: resource visibility

Posted by David Jencks <da...@yahoo.com>.
well.... getClass().getClassLoader() might possibly not be the  
applications classloader???  Do you get the same result if you  
precompile the jsp?

thanks
david jencks

On Jan 25, 2007, at 12:31 PM, Jarek Gawor wrote:

> Hi,
>
> I have a question on resource visibly to classloaders. Here's an
> example. I have a following JSP page packaged in .war file. The JSP
> tries to load some descriptors packaged in the war file in two
> different ways. The question is should the fist method work?
>
> The JSP does:
>
> System.out.println(getClass().getResource("/WEB-INF/web.xml"));
>    System.out.println(getServletConfig().getServletContext 
> ().getResource("/WEB-INF/web.xml"));
>
> and first method returns null but second works as expected. Anybody
> knows quick answer to this?
>
> Thanks,
> Jarek