osgiosgi-fragment

Installing a fragment requires a refresh on the host, how can this be avoided?


I have two bundles: bundle A and bundle B which is configured as a fragment of bundle A using: Fragment-Host:

Whenever I install bundle B it fails to start (INSTALLED) and therefore to attach itseld to bundle A.

At this point when I check bundle A's status I see that it still doesn't recognize bundle B as its fragment.

If I do refresh bundle A it solves the problem - bundle B switches to RESOLVED and is able to attach itself to bundle A, bundle A recognizes bundle B as its fragment and everything is working as expected.

My question is how this refresh can be avoided, i.e. as soon as bundle B is installed it should attach itself to its host which is already ACTIVE.

Thank you.


Solution

  • You cannot do that without a refresh, and it's in the OSGI specs too - to properly attach a fragment bundle, a transition from INSTALLED to RESOLVED of the host bundle is necessary. See section 3.14 of the 4.3 OSGi Core Specification.