OSGi bundle in Karaf rewires to a dependent bundle if the dependent package version is later, even though an exact dependency is specified in the manifest

Solution Verified - Updated -

Issue

An installation based on Fuse on Karaf has several different sets of bundles with the same names installed. These represent different versions of an application; the OSGi dependency version mechanism is expected to ensure that each bundle that has a dependency wires to, and only to, the matching dependent bundle.

An OSGi bundle has a dependency on the Java package com.acme.foo, with a specific version. The dependency is specified in the bundle's MANIFEST.MF file like this:

Import-Package: com.acme.foo;version="1.0.0",...

However, it seems that if a later version of the bundle that contains com.acme.foo is installed, the bundle having that dependency will rewire to the later version, despite the explicit version specification in the manifest.

Environment

  • Red Hat Fuse
    • 6.x
    • 7.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In