dev@glassfish.java.net

Re: [v3] Can't I rely on getURLs() anymore?

From: Kin-man Chung <Kin-Man.Chung_at_Sun.COM>
Date: Tue, 10 Jun 2008 10:14:22 -0700

Sahoo wrote:
> I remember seeing similar code when I was enabling OSGi in v3 and I had
> got it working. Are you saying that JSP support in v3 is broken now?
>
There is a problem in the current JSP support and Shing Wai was looking
into it and I believe the cause is known. However, the problem I ran
into was different. When I made JSP a module, webtier.jar now depends
jsp.jar, but jsp.jar is not included in the URLs returned from
getURLs(). To do that, jsp.jar has to be manually included in the URL
list when WebClassLoader was created. So my problem was solved, thanks
to Sing War for his help.

I think all modules that webtier depends on should be automatically
included in the URLs for its classloader.

> Secondly, classloader is not always of type URLClassLoader. Can't the
> Java compiler be improved to use a ClassLoader to find required
> resource? If JDK folks fix this bug [1], would that solve the issue for
> JDK 6 at least?
>
It would be nice if Javac, when invoked programmatically using Jsr199,
can take a ClassLaoder instead of a classpath to resolve references, but
[1] is only a RFE, and is not fixed in JDK 6, sadly.

-Kin-man

> Thanks,
> Sahoo
>
> [1] http://monaco.sfbay.sun.com/detail.jsf?cr=6297388
>
> Kin-man Chung wrote:
>> In Jasper, to set the classpath for the Java compiler, we have been
>> using the following algorithm (simplified):
>>
>> loader = currentThread.getContextLoader();
>> while (loader != null) {
>> for (URLClassLoader cl: loader.getURLs()) {
>> classpath.append(cl);
>> }
>> loader = loader.getParent();
>> }
>>
>> This no longer works in V3. Jasper is now a separate module, and
>> the classpath so obtained does not include jasper.jar itself!
>>
>> I'd appreciate any light that can shed on this issue.
>>
>> -Kin-man
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>