Hi, Ulf Dittmer schrieb: > Hello everyone- > > I'm having difficulties getting the ConfigurationAdmin bundle to work. I > have a host application that starts a Felix container; it has > felix-1.6.1.jar and org.apache.felix.configadmin-1.0.10.jar in CLASSPATH.
Why do you have the configadmin bundle in the class path ? This makes no sense since you install the bundle into the framework. If you want to share the configuration admin API, I suggest you add the compendium JAR file to the classpath and make sure the packages of the compendium library are listed in the system.packages of the framework such that the bundles inside the framework are using the same class instances as your application outside the framework. You might also want to refer to [1] HTH Regards Felix [1] http://felix.apache.org/site/apache-felix-framework-launching-and-embedding.html > > Installing the ConfigurationAdmin bundle into the container works fine, > and the services are registered, but trying to obtain the service > interface like this in a ServiceListener: > > String[] objectClass = (String[]) > event.getServiceReference().getProperty(Constants.OBJECTCLASS); > ServiceReference servRef = context.getServiceReference(objectClass[0]); > ConfigurationAdmin configAdmin = (ConfigurationAdmin) > context.getService(servRef); > > results in: > > java.lang.ClassCastException: > org.apache.felix.cm.impl.ConfigurationAdminImpl > > Intuitively that makes sense - It's returning an object loaded by a > different classloader, but the class ConfigurationAdmin is also in the > application class loader's classpath. > > But both the host application and the bundle need to have the > ConfigurationAdmin class in the classpath, because both use it. > > > I see that the PermissionAdmin bundle seems to be able to avoid this, > but its manifest looks differently - it has no Import-Package, but an > Ignore-Package (which, just like Private-Package, doesn't seem to be > part of the spec, and isn't mentioned in the Maven Bundle plugin page). > > > So, how can I avoid this problem? I'm getting the feeling that there's > something quite basic that I'm not understanding about how bundles work; > any hint in the right direction would be much appreciated. > > Many thanks in advance, > Ulf > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

