Is there anyway to make it work ? I need to include the jar in to two bundles.
Just for information my situation like this;
1. One java project containing interfaces and util exported as jar - util.jar
2. One java project implementing the OSGI Activator interface , this is implemented as abstract class providing two abstract interfaces bundleStart and bundleStop , from Activator method start and stop we call bundleStart and bundleStop implemented by OSGI bundles - wrapper.jar. This is to make sure that other bundles dont need to worry about OSGI things. In this wrapper we also provide functions to register services to bundle context and retrieving it.
3. Each OSGI bundle includes these two jars in their class path. 4. I have noticed that the wrapper.jar provides some APIs which can return the objects from the bundle context , their interfaces where defined in util.jar and implemented by one of the OSGI bundle and register to bundle context.
5. The casting problem comes only when I use this in start method of wrraper if I try to retrieve the object outside the start method it works.