Question

I'm attempting to use the fuse application bundle tool in my features.xml as described at the bottom of http://fuse.fusesource.org/bundle/faq.html and install the feature at startup, however I believe I'm having a problem with the startup order.

I believe it's the fabric-bundle feature that includes the Fuse Application Bundles bundle which I have in my org.apache.karaf.features.cfg file as:

#
# Comma separated list of features to install at startup
#
featuresBoot=fabric-bundle,(some other features),myfeature

My feature is defined similar to the following:

<feature name="myfeature" version="${project.version}">
    <bundle>fab:mvn:com.company/mybundle/${project.version}</bundle>
</feature>

but when starting up I notice this in my logs:

16:31:20,785 | DEBUG | t-60024-thread-1 | FeaturesServiceImpl              | 22 - org.apache.karaf.features.core - 2.3.0.redhat-60024 | Installing feature myfeature 2.0.0-SNAPSHOT
16:31:20,786 | DEBUG | t-60024-thread-1 | FeaturesServiceImpl              | 22 - org.apache.karaf.features.core - 2.3.0.redhat-60024 | Checking fab:mvn:com.company/mybundle/2.0.0-SNAPSHOT
16:31:20,789 | WARN  | t-60024-thread-1 | FeaturesServiceImpl              | 22 - org.apache.karaf.features.core - 2.3.0.redhat-60024 | Error when installing feature myfeature: java.net.MalformedURLException: Unknown protocol: fab

I noticed that the Fuse Application Bundles bundle (fab-osgi) is actually started 3 seconds later:

16:31:23,436 | DEBUG | lixDispatchQueue | fab-osgi                         | 61 - org.fusesource.fabric.fab.fab-osgi - 7.2.0.redhat-024 | BundleEvent STARTED - org.fusesource.fabric.fab.fab-osgi

Therefore now once the server is started in the shell I can run

features:install myfeature

and the feature is successfully installed.

So I believe I need to ensure the Fuse Application Bundles bundle is installed and started at startup prior to attempting to install and start my feature. How can I achieve this?

Cheers,

Tom

Was it helpful?

Solution

In the version of Fuse I was using - 6.0 (Redhat 60042) - The fabric bundle and it's dependencies aren't started before the feature bundles so the features bundle has no knowledge about the fab protocol. Ensuring the fabric bundle is started before the features bundle can be accomplished by adding the following to your startup.properties:

org/fusesource/fabric/fab/fab-osgi/7.2.0.redhat-024/fab-osgi-7.2.0.redhat-024.jar=10
org/fusesource/fabric/common-util/7.2.0.redhat-024/common-util-7.2.0.redhat-024.jar=10
org/ops4j/base/ops4j-base-net/1.2.2/ops4j-base-net-1.2.2.jar=10
org/ops4j/base/ops4j-base-lang/1.2.2/ops4j-base-lang-1.2.2.jar=10
org/ops4j/base/ops4j-base-util-property/1.2.2/ops4j-base-util-property-1.2.2.jar=10
org/ops4j/pax/swissbox/pax-swissbox-optional-jcl/1.3.1/pax-swissbox-optional-jcl-1.3.1.jar=10
org/ops4j/base/ops4j-base-monitors/1.2.2/ops4j-base-monitors-1.2.2.jar=10
org/ops4j/pax/swissbox/pax-swissbox-property/1.2.0/pax-swissbox-property-1.2.0.jar=10

I'm not sure that 10 is an appropriate start level but it seemed to work for me without problems.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top