I'm developing an "installer" bundle that reads a simple list of bundles,
fetches the jars for each and installs them. One of these bundles in the
Felix Configuration Admin. After the installer successfully installs the
configuration admin bundle and starts it up, I am trying to get the
installer to actually obtain the Configuration Admin service and push out
some configuration to the bundles that were installed. 

However, I have yet to get the configuration part to work because of
classloading issues.  

The following code is executed in the "installer" bundle after it has
already installed and started up the other bundles:

ServiceReference ref = _bundleContext.getServiceReference(OSGI_CONF_ADMIN);
if (ref != null) {
         ConfigurationAdmin svc =  (ConfigurationAdmin)
_bundleContext.getService(ref);  // breaks here
         .
         .
}

java.lang.ClassCastException:
org.apache.felix.cm.impl.ConfigurationAdminImpl
        at
com.as.bb.osgi.config.ServiceConfigSourceImpl.configure(ServiceConfigSourceImpl.java:28)
        at com.as.bb.osgi.ProfileXml.executeConfigSources(ProfileXml.java:225)
        at com.as.bb.osgi.ProfileXml.configure(ProfileXml.java:213)
        at
com.as.bb.osgi.ProvisioningAgent.installProfile(ProvisioningAgent.java:38)
        at com.as.bb.osgi.Activator.start(Activator.java:45)
        at
org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:589)
             at
org.apache.felix.framework.Felix._startBundle(Felix.java:1585)
        at org.apache.felix.framework.Felix.startBundle(Felix.java:1519)
        at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:354)
        at
test.FelixBootstrapBaseTest.startBundles(FelixBootstrapBaseTest.java:238)
        at test.InstallerTest.testStartup(InstallerTest.java:23)

What I am trying to avoid is having to install the Configuration Admin
bundle before I install the "installer" bundle. I have tried a few things to
get this to work...1) Adding a Dynamic Import to the manifest 2) Including
the osgi compendium and config admin jars in the Installer bundle and
setting them in the bundle classpath. No luck with either.

Any hints on how bundle A can install bundle B and then obtain a reference
to a service exported by bundle B would be really appreciated.



-- 
View this message in context: 
http://www.nabble.com/Bundle-installing-another-Bundle-tp16305907p16305907.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to