dev@glassfish.java.net

Re: OSGi Fragment bundle development help

From: Richard S. Hall <heavy_at_ungoverned.org>
Date: Wed, 16 Feb 2011 09:55:47 -0500

On 2/15/11 17:26, PostMasteR wrote:
> Hi *,
>
> I currently have multiple Fragment bundles which I have to maintain.
> Some times the Fragments just won't attach to their host for some good
> reason. But there is no way to "inspect" such a fragment bundle to see
> what is wrong with it, which makes it a pretty time intensive operation
> to realign a fragment bundle if it changes.

Try setting the Felix framework's log level to 4 (i.e., DEBUG) in
glassfish3/glassfish/osgi/felix/conf/config.properties. This may give
you more information as to why the fragment is not attaching. There are
generally only two reasons why a fragment won't attach:

   1. Its host bundle is already resolved. Felix doesn't support
      attaching fragments to resolved hosts.
   2. Its dependencies conflict with the host.

If it's the latter, then I think you should see a message logged if you
enable debug logging.

> In addition I already found out by try'n'error that package imports with
> versions just don't work with Fragment bundles, which is rather
> counter-productive.

I don't think that's true. Certainly it has been tested. Perhaps you've
found some bug. If you could create a simple example, you could send it
to me directly or create an issue over at the Apache Felix project and
attach it.

> So, are there any tools or is there some gogo command to see what's
> going wrong?

If it is not attaching, the only thing you can do is enable debug
logging and try to resolve the fragment and see if it prints out any
information.

-> richard

> Thanx,
>
> PMR