Capabilities bundles with different startlevel are installed at same time
dastraub Jan 10, 2013 4:20 AMAll capabilities are first installled and and then started in the order of their starting level.
This could cause trouble if during the bundle installation services of a bundle are needed with a smaller startlevel.
I stumbled about it when I tried to use a own XRepository implementation (see other discussions about maven url).
I created a bundle with an XRepository implementation and register this in a bundle activator.
public class SampleRepositoryBundleActivator implements BundleActivator {
@Override
public void start(BundleContext context) throws Exception {
context.registerService(XRepository.class.getName(), new SampleRepository(), null);
}
...
I configured my capabilties like this :
...
<capability name="training.samples.osgi.xrepo" startlevel="1"/>
<capability name="commons-collections:commons-collections:3.2.1" startlevel="2"/>
<capability name="org.apache.karaf.demos:org.apache.karaf.demos.branding.shell:2.2.4" startlevel="2"/>
<capability name="org.apache.servicemix.specs:org.apache.servicemix.specs.activation-api-1.1:1.9.0" startlevel="2"/>
...
I excpected now, my bundle has been started before the installation of the other bundles, so that my repository is also used during resolving of the remaining bundles.
Unfortunatly not
09:41:34,974 INFO [org.jboss.osgi.repository] (MSC service thread 1-16) JBOSGI020400: Find maven providers for: MavenCoordinates[org.apache.servicemix.jbi:org.apache.servicemix.jbi.osgi:jar:1.5.0]
09:41:34,975 INFO [org.jboss.osgi.repository] (MSC service thread 1-16) JBOSGI020401: Found maven resource: URLResource[org.apache.servicemix.jbi.osgi:1.5.0]
09:41:34,989 INFO [org.jboss.osgi.repository] (MSC service thread 1-16) JBOSGI020400: Find maven providers for: MavenCoordinates[org.apache.servicemix.jbi:org.apache.servicemix.jbi.deployer:jar:1.5.0]
09:41:34,990 INFO [org.jboss.osgi.repository] (MSC service thread 1-16) JBOSGI020401: Found maven resource: URLResource[org.apache.servicemix.jbi.deployer:1.5.0]
...
09:41:35,042 INFO [org.jboss.osgi.framework] (MSC service thread 1-13) JBOSGI011001: Bundle installed: org.apache.felix.configadmin:1.2.8
09:41:35,042 INFO [org.jboss.osgi.framework] (MSC service thread 1-15) JBOSGI011001: Bundle installed: org.apache.servicemix.jbi.deployer:1.5.0
09:41:35,042 INFO [org.jboss.osgi.framework] (MSC service thread 1-1) JBOSGI011001: Bundle installed: repo-skeleton:1.0.0.SNAPSHOT
...
09:41:35,842 INFO [org.jboss.osgi.framework] (MSC service thread 1-6) JBOSGI011011: Starting bundles for start level: 1
09:41:35,845 INFO [org.jboss.osgi.framework] (MSC service thread 1-6) JBOSGI011002: Bundle started: repo-skeleton:1.0.0.SNAPSHOT
09:41:35,845 INFO [org.jboss.osgi.framework] (MSC service thread 1-6) JBOSGI011011: Starting bundles for start level: 2
09:41:35,849 INFO [org.jboss.osgi.framework] (MSC service thread 1-6) JBOSGI011002: Bundle started: org.apache.felix.log:1.0.0
Ok, I think this not a common use case.
But otherwise, this is a simpler solution to use a own repository instead to create a JBoss subsystem what I did as solution in another thread.
-
repo-skeleton.zip 6.2 KB