Cannot find service because OSGi package is not activated

I am having trouble finding services that are provided by some OSGi packages that are not activated. Let me describe the situation:

  • Package A defines interface X
  • B, C, and D provide services that implement the X interface
    • The services of these bundles are registered through Spring DM, so they are created only when the package is activated, and Spring DM initialized the application context defined in the package
  • Package A activates and at some point requests a registry of services for services for interface X. It does not find any, because packages B, C, and D were not moved to the ACTIVE state (they only SET).

It seems that I cannot get bundles B, C or D, and therefore register their services. Making them start by adding them to is config.ininot an option, because there can be any number of packages installed in the application (via an update mechanism similar to Eclipse p2) that implement the X interface.

The application is an Rcl application based on Eclipse 3.5, using Spring 2.5.6 and Spring DM 1.2.1.

How to make these ligaments activate?

+5
source share
3 answers

You really have a problem in the dependency hierarchy, your proposed hacker solution is just group help on the main problem.

, , , , , - (re: ). ( ). A ( ) B C. , B C A , , , A.

B C, A, ( ) . , , - A , A1 A2.

A1 , B C ( ). A2 B C. , B C, A1, A2 , .

+6

, , .

, , " " .

, :

  • B, C D , , "MyApp-AutoStart: true"
  • , , RESOLVED,
  • "true", bundle.start()

, , , config.ini, , , .

0

Also look at the felix file installation, which monitors the package directory and automatically installs and runs them. When a file is deleted, the package also stops and is deleted.

0
source

All Articles