0

I have 2 osgi bundles (say A and B) running in Jboss Fuse. I am using Felix. 'A' bundle exposes a service which 'B' bundle uses. When I deploy both these bundles there is no problem. When I execute osgi:ls -u, I see that bundle 'B' is using service exposed by bundle 'A'

After I restart these 2 bundles together Bundle 'B' cannot find service exposed by Bundle 'A'. At this stage if I execute command osgi:ls, I see OSGI service exposed by bundle 'A'. When I execute osgi:ls -u, I don't see that bundle 'B' is using service exposed by bundle 'A'

I got 2 workaround for this problem

  1. At this stage if I restart only bundle 'B', then bundle 'B' finds OSGI service exposed by Bundle 'A'. Restarting bundle is not obvious official solution :)
  2. In bundle 'B', while importing osgi service, if add cardinality as 0:1 then I don't find any issue. But I cant do this as service exposed by bundle 'A' is mandatory for some functionality in bundle 'B'

Can anyone tell me why I am observing this behavior and how I can resolve it ? ?

PravinS
  • 2,640
  • 3
  • 21
  • 25
Rajjy
  • 176
  • 13

1 Answers1

0

Noted that this could happen when bundle B creates its app ctx outside the normal spring extender process. For instance, bundle B creates an app ctx based on an external event and the app ctx imports the osgi service exported from the bundle A. If you are using spring-dm to export/import osgi services, use ServiceTracker via BundleActivator instead.

  • With a bit more rep, [you will be able to flag duplicate questions like this](http://stackoverflow.com/privileges/comment). Until then, posting links as answers is not really ideal, and they will generally be deleted. – Nathan Tuggy Jul 06 '15 at 02:00