I'm having a problem discovering services that are provided by some OSGi bundles that are not being activated. Let me describe the situation:
- Bundle A defines interface X
- Bundles B, C, and D provide services that implement interface X
- These bundles' services are registered via Spring DM, so they are only created when the bundle is activated and Spring DM initialized the application context defined in the bundle
- Bundle A is activated and at some point asks the service registry for services for interface X. It doesn't find any, because bundles B, C, and D haven't been moved into the ACTIVE state (they are only RESOLVED).
I cannot seem to get bundles B, C, or D to start, and therefore register their services. Forcing them to start by adding them to the config.ini
is not an option, because there can be any number of bundles that are installed in the application (via an Eclipse p2-like update mechanism) that implement interface X.
The application is an Eclipse 3.5-based RCP app, using Spring 2.5.6 and Spring DM 1.2.1.
How do I force these bundles to be activated?
A
? If it's1..N
you have a circular dependency. – Mark ElliotA
is0..N
. Could you elaborate on how1..N
causes a circular dependency? I don't quite understand that. – Paul Schifferer1..N
you'd require an instance from bundlesB
andC
before you could startA
, butB
andC
have a strict dependency onA
, so none of the bundles would be able to come up. What happens if you manually refreshA
, thenB
thenC
? – Mark Elliot