dev@glassfish.java.net

Re: broken Felix classloader?

From: Sahoo <Sahoo_at_Sun.COM>
Date: Fri, 24 Apr 2009 13:40:14 +0530

Lloyd Chambers wrote:
> Richard,
>
> I found that I was mistaken about module amx-config. It had no
> reference to javax.management, so it had no Import-Package directive
> for it.
>
> That OSGi prevents access to standard JDK classes defies common sense
> IMO, but that's the last I'll gripe about it.
>
> ...
>
> The simplest solution I found was to add a dummy interface in the module:
>
> public interface ForceThisModuleToHaveAccesstoTheseTypes
> {
> public javax.management.ObjectName
> forceInclusionOf_javax_management();
> }
>
> Adding this class causes Import-Package to include javax.management.
>
If you want some Import-Package to appear in the bundle's manifest
header, instead of doing what you have said above, add the appropriate
package in osgi.bundle file which resides next to pom.xml of the bundle.
You can do something like this:
Import-Package: javax.management, *

Thanks,
Sahoo