Search code examples
javajbossfusefuseesb

Deploy camel project in fuse fabric


Following things i want to know to deploy camel projects in fuse fabric environment. I have created bundle jars. These bundle jars work well in a non-fabric environment. i-e when i move these jars to deploy directory on jboss-fuse it works perfectly. When the same jars are moved to child containers it does not work. Things that i have setup for fabric environment is as follow:

Created Fabric container:

fabric:create --new-user fadmin --new-user-password maskerkey --generate-zookeeper-password --resolver localip

Child containers:

fabric:container-create-child root node 2

How should i deploy same bundle jars to child containers? The following exception i am seeing when i deploy bundle jars:

org.osgi.framework.BundleException: Unresolved constraint in bundle BUNDLE_NAME [139]: Unable to resolve 139.0: missing requirement [139.0] osgi.wiring.package; (osgi.wiring.package=org.apache.activemq.camel.component)

Solution

  • When you have fabric environment, you should never use deploy/ directory. It's rather for prototyping purposes.

    When you have created child containers using:

    fabric:container-create-child root node 2
    

    You have now two containers named node1 and node2

    A bundle in OSGi is just an enhanced JAR.

    A (Karaf) feature is a collection of bundles (and possibly configurations), so you can install multiple bundles more easily.

    A (Fabric) profile is a declaration of bundles, features, configurations and resources (roughly), so you can install multiple (karaf) features more easily.

    Your error message means that there's no bundle already installed, that could satisfy a requirement of your bundle. More precisely, you lack a bundle that exports org.apache.activemq.camel.component package.

    If you look at profiles and features available with Fuse, you'll see:

    JBossFuse:karaf@root> features:info activemq-camel
    Description of activemq-camel 5.11.0.redhat-vvv feature
    ----------------------------------------------------------------
    Feature has no configuration
    Feature has no configuration files
    Feature depends on:
      activemq-client 5.11.0.redhat-vvv
      camel-spring [2.17,3)
      camel-jms [2.17,3)
      camel [2.17,3)
    Feature contains followed bundles:
     mvn:org.apache.activemq/activemq-camel/5.11.0.redhat-vvv start-level=50
    Feature has no conditionals.
    

    (where vvv is given build of Fuse).

    Now you have to create your profile:

    profile-create myprofile
    

    Add activemq-camel feature to it:

    profile-edit --feature activemq-camel myprofile
    

    Add your bundle to it:

    profile-edit --bundle mvn:your-groupId/your-artifactId/your-version
    

    And assign this profile to a container (containers)

    container-add-profile node1 myprofile