dev@glassfish.java.net

OSGi confusion...

From: Peter Williams <Pete.Williams_at_Sun.COM>
Date: Tue, 19 May 2009 13:08:09 -0700

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?!)

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