Hi Mirko

As i promised, i'm back with some results after trying your suggestions.

To clarify from the start the problem, i paste here the short description of
my case: i have an API, something like javax.jms. and my.package.myinterface
packed in a separate bundle used by all satellite bundles.

Also i use the ServiceTracker class to track the services life, like this:
in each satellite bundle, in the start(BundleContext) method, i put
something like:


MyInterface connection = new ASpecificImpl();
props.put("Name", context.getBundle().getSymbolicName());

ServiceRegistration sr =
context.registerService(MyInterface.class.getName(),
                connection, props);
 this.tracker = new ServiceTracker(context, sr.getReference(), null);
 this.tracker.open();


and from the main bundle i try to get an implementation something like:

        Filter filter =
this.bundleContext.createFilter("(Name="+implName+")");
        ServiceTracker tracker = new ServiceTracker(this.bundleContext,
filter, null);
        tracker.open();

       MyInterface object = (MyInterface)tracker.getService();

Now, from time to time i get null reference for a certain implementation
(although i manually install & start the bundles if these aren;t started, i
use Platform.getBundle(symbolicName) )

More over, i have seen that if an implementation is used for doing a job,
and another implementation is requested from ServiceTracker, then this
second one used the classpath from the first one (that's just weird !),
droping its onw jars & libs !

Also, i've searched over the net for a solution, and the only one it seems
to be

osgi.java.profile.bootdelegation=none.

Now, is this a common situation, that the classloader mixex their classpath?

Regards,
Daniel
_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to