dev@glassfish.java.net

Re: review for issue #7507 - jar file specified with deploy's --libraries not referenceable from webapp

From: Sahoo <Sahoo_at_Sun.COM>
Date: Fri, 03 Apr 2009 17:07:00 +0530

Unless JSP module does something special, this bug should show up in v3
as well. The fix may not be entirely possible given the modular nature
of V3, which means we are not in control of classloaders for all modules
of an application. However, we can definitely fix the problem for most
cases. Actually I am pretty sure there are many more URLs not added to
JSPC's classpath in v3. e.g., URLs of deployed standalone RARs. The fix
is needed in following places:

1. add a getClassPath() method in
org.glassfish.internal.api.DelegatingClassLoader.ClassFinder. Add
getClassPath method in
org.glassfish.internal.api.DelegatingClassLoader. The implementation of
the latter method should delegate to all the delegates before asking if
the parent has any ClassPath.

2. add a similar method in classloaders below AppLibClassLoader and use
it in appropriate place.

Thanks,
Sahoo

Dies Koper wrote:
> Hi Siva, Jerome, Kin-Man, Sahoo,
>
> Could you assist me to fix issue #7507?
> (Kin-Man reported a similar issue (#4883) and reported it was fixed, but
> may that was just for WAR files, I'm seeing it for EAR files.)
>
> I have attached a fix to the issue. I confirmed it works on V2.1.
> https://glassfish.dev.java.net/issues/show_bug.cgi?id=7507
>
> I changed the following class (who's in charge of this file?).
> glassfish/appserv-core/src/java/com/sun/appserv/server/util/ClassLoaderChain.java
>
> Could you review it?
>
> When compiling the JSP, the classpath is taken from the
> WebappClassLoader up. The path specified to the --libraries option is
> kept in ASURLClassLoader, which is held by ClassLoaderChain.
>
> ConnectorClassLoader (extends URLClassLoader)
> |
> ClassLoaderChain (extends SecureClassLoader) <---
> |
> EJBClassLoader (extends URLClassLoader)
> |
> WebappClassLoader (extends URLClassLoader)
> |
> JspLoader (extends URLClassLoader)
>
> The classpath is constructed using URLClassLoader#getURLs but
> ClassLoaderChain does not extend URLClassLoader so the path can't be
> obtained that way, and it provides no method to obtain the URLs from the
> classloader it holds.
> The proposed patch offers that method.
>
>
> This class has been refactored out in V3. Where would I put these
> methods to make it work for GF V3 too?
>
> Thanks,
> Dies
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>
>