[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[equinox-dev] Framework launching and class loaders

I'm using the framework launching API to start an OSGi framework (which in this case is Equinox 3.5M6).
I need to pass some configuration from the launcher application to one of the bundles running so I thought
of using the ConfigurationAdmin service for this.
The launcher gets hold of a BundleContext (from the framework handle) and gets a reference to the
service; ServiceReference reference = context.getServiceReference(...)
But I get into trouble on the next step
ConfigurationAdmin cAdmin = (ConfigurationAdmin) context.getService(reference);
This throws a ClassCastException. The actual object returned uses equinox's class loader while the class I'm
trying to cast to, ConfigurationAdmin, is loaded through the launcher's standard class loader
(sun.misc.Launcher$AppClassLoader in this case).
How can I go around this? Shouldn't I be playing with OSGi services outside the framework like this? In
that case how should I pass configuration from the launcher to the bundle?
-Patrik Jansson