[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [equinox-dev] Framework launching and class loaders
- From: Jansson Patrik <patrik.jansson@xxxxxxxxxxxxx>
- Date: Tue, 26 May 2009 10:42:05 +0200
- Accept-language: sv-SE, en-US
- Acceptlanguage: sv-SE, en-US
- Delivered-to: firstname.lastname@example.org
- Thread-index: AcndOmaqIPa9R2yuQ6G8CozpFSOO1AAol31w
- Thread-topic: [equinox-dev] Framework launching and class loaders
What will happen if I let the org.eclipse.osgi.services
bundle remain resolved in my OSGi framework and the system bundle export the
same version of org.osgi.service.cm? Which package will be imported by other
bundles (eclipse implementation of ConfigurationAdmin being one of
That way, I don't have to care about exporting packages
inside org.eclipse.osgi.services that is not mutually shared by the launcher and
bundles inside the framework. So, what I'm asking for is a way to override a
specific package exported by a bundle (but not all of them), is that
The org.osgi.service.cm package has 2
"version" in your example. One loaded from a bundle and used by the
ConfigurationAdmin service implementation and the other on the application
classpath. You need to either use reflection to use the service (then you don't
need the version on the classpath) or you need to configure the framework to
export the version on the package on the application classpath from the system
bundle (org.osgi.framework.systempackages.extra) so that the ConfigurationAdmin
bundle uses that version of the package.
||[equinox-dev] Framework launching and
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.
launcher gets hold of a BundleContext (from the framework handle) and gets a
reference to the
reference = context.getServiceReference(...)
But I get into trouble on the
ConfigurationAdmin cAdmin =
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?
that case how should I pass configuration
from the launcher to the bundle?