[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: Mon, 25 May 2009 16:02:32 +0200
- Accept-language: sv-SE
- Acceptlanguage: sv-SE
- Delivered-to: firstname.lastname@example.org
- Thread-index: AcndOmaqIPa9R2yuQ6G8CozpFSOO1AABoxdg
- Thread-topic: [equinox-dev] Framework launching and class loaders
went for the 2nd solution, exporting the package through
It seems to work just fine!
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?