I started developping an OSGI bundle base application. I created a bundle A that consumes service from bundle B, wich in its turn must consume service from bundle C.
But i dont see how get a service inside the code of another. The servicetracker needs the bundlecontext and i don't have a bundlecontext in my service code.
Thanks in advance,
Best How To :
In your service B code you should have a setter for the interface of service C.
You then start the ServiceTracker from the bundle Activator in bundle B. When the service C is added you create service B, when it is remove your remove it.
If you do not want to do this by hand you can look into declarative services, blueprint or ipojo. All these all you to specify these dependencies declaratively.