Thank you. Looks like I had the CM package on the bundle classpath and as a
dynamic import. It worked when i removed it from the bundle classpath.
Richard S. Hall wrote:
>
> The following setup should work:
>
> 1. Installer bundle dynamically imports the org.osgi.service.cm
> package.
> 2. Config admin bundle exports the CM package (or from a separate
> bundle).
> 3. Have your installer bundle install and start the CM bundle.
> 4. Have your installer bundle get a reference to the CM service.
>
> If this isn't working, then you likely have a packaging issue. Perhaps
> you have embedded the CM classes into your installer and are exporting
> them, but not importing them or have them available from multiple
> places? Double check to see where all the wirings for the CM package are
> going.
>
> -> richard
>
> rcohen16 wrote:
>> 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.
>>
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
View this message in context:
http://www.nabble.com/Bundle-installing-another-Bundle-tp16305907p16315120.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]