Trying to get Declarative Services SCR to run on WebSphere 8.5 (non-liberty)

189 views Asked by At

I have a blueprint-managed OSGI application running on WebSphere v8.5(Non-Liberty Profile) where one service, Service_A, has a reference to another service, Service_B. I would like the Service_B to be managed by the declarative services service component runtime instead of the blueprint container, but still have Service_A be blueprint managed.

I believe I'm encountering difficulty getting the SCR to run. I'm not sure if I'm including it properly, or how I can check to see if its running. I've defined 'activate' and 'deactivate' in Service_B's implementation with some print statements, that to my understanding, should be being called by the SCR when it locates the service as I understand it, but i'm pretty sure they're not being called because break-points don't stop there and I see no output in the console.

My effort thus far to include the runtime is as follows:

To my understanding, the following three jars/bundles are all that's needed to run the SCR.

  • org.eclipse.equinox.ds
  • org.eclipse.equinox.util
  • org.eclipse.osgi.services

I went ahead and created a new OSGI bundle/jar containing all of the above mentioned jar files, then just passed on the exports of each jar in this new bundle. I then added this DS bundle to my main OSGI application and imported each of these DS bundle exports into the bundle containing the service that is to be managed by the SCR.

This is where I appear to be getting hung up:

The OSGI framework is loading the bundle containing the service but the service is not being added to the registry, which suggests that the component.xml file defining the service isn't being read, which, intern suggests that the SCR is not running because it is what reads that file to my understanding.

So still stuck on the ability to get the SCR running. Any and all help greatly appreciated! Am under a very tight deadline (I know… who isn't right? :)) and all help is graciously welcomed! Thanks!

1

There are 1 answers

2
Arie van Wijngaarden On

I am not familiar with WebSphere, but the problem, I guess is in the following statement from your post: "I went ahead and created a new OSGI bundle/jar containing all of the above mentioned jar files, then just passed on the exports of each jar in this new bundle". This is incorrect.

What you should do is:

  1. Load the bundles that form together a working DS implementation separately into your OSGi environment, meaning: as individual bundles (they are bundles already).
  2. Create a separate bundle for your code and xml related to Service_B.

Only in this way the SCR is able to pick-up your bundle and create services for it. A SCR is a separate bundle that tracks other bundles for DS components and handles these declarations accordingly.