What is the best approach to update a bundle using file URL handler in Red Hat JBoss Fuse 6.x?

Solution Unverified - Updated -

Environment

  • Red Hat JBoss Fuse
    • 6.x

Issue

  • Is there a best approach to update my bundle using file URL pattern?
  • My bundle doesn't update after a new deployment in a Karaf container.
  • I'm not using Maven to deploy bundles in Karaf, how to update it after a new deployment?

Resolution

The best way to update a bundle deployed with file: scheme is using the command osgi:update <BUNDLE_ID>. Thus there's no need to perform a container restart, nor a profile-refresh. This procedure is exemplified below:

JBossFuse:karaf@root> la -l
START LEVEL 100 , List Threshold: 0
   ID   State         Blueprint      Spring    Level  Location
[   0] [Active     ] [            ] [       ] [    0] System Bundle
...
[ 306] [Active     ] [            ] [       ] [   80] file:///home/myuser/.m2/repository/org/test/bundle-api/0.1.0.BUILD-SNAPSHOT/bundle-api-0.1.0.BUILD-SNAPSHOT.jar
JBossFuse:karaf@root> update 306
JBossFuse:karaf@root> 

fabric-agent explicitly manages CRC checksums for all non mvn: bundles (and mvn:xxx/.../*-SNAPSHOT bundles too).
profile-refresh does similar - if it detects CRC change for non-release mvn: artifact (i.e. for any non mvn: artifact and for mvn: artifact with SNAPSHOT version), then the bundle is both updated and refreshed.

For more information, please check the Red Hat JBoss Fuse documentation, Appendix A. URL Handlers - File URL Handler.

Root Cause

Using file: scheme to deploy bundles in a profile without version management, the Karaf container may not get the bundle changes. In cases like this, the best approach is run the osgi:update command to force a bundle update.

Consider reading the section Deploying into Apache Karaf, Building OSGi Bundles for OSGi best practices.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.