dev@glassfish.java.net

Re: OSGi confusion...

From: Richard S. Hall <heavy_at_ungoverned.org>
Date: Wed, 20 May 2009 15:24:59 -0400

On 5/19/09 4:08 PM, Peter Williams wrote:
> I'm investigating a JavaMail failure in V3 that is caused by the
> current OSGi configuration and I'm trying to figure out how to fix it.
>
> The issue is this: Code in the JDK (JAF in this case) is calling
> getResources() on the current context classloader (web app classloader
> in my test case, but probably could another one) to locate any
> available mailcap files. It's trying to find META-INF/mailcap.default
> in javax.mail.jar. This fails, the code breaks. Outside of OSGi,
> this all works fine.
>
> So what needed to happen here to make this work? Should
> javax.mail.jar be exporting META-INF? How? Does the JDK have to
> import this? (how?!)

If I understand correctly, it sounds like JAF expects to be able to
access every available JAR file by accessing the context class loader.
This is a recipe for failure in OSGi.

Typically, these sorts of situations involve some sort of extender
listening for bundles with mailcap files and then the information in
them can be injected where appropriate.

Unfortunately, I don't know enough about JAF to say in detail how this
might work.

-> richard

>
> Once this is resolved, I'm worried about the next step -- the
> definitions in the mailcap file refer to implementations of
> DataHandlers (JAF interface) that are in a private package of
> javax.mail.jar. I hope I'm wrong, but I suspect JAF will be unable to
> access these classes to instantiate them. What is the solution?
> Export those packages too? Even though they are supposed to be private?
>
> -Peter
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>