Last updated Feb 20, 2024

BundleException with no bundle constraint specified

Symptoms -- What Goes Wrong

A plugin fails to load at runtime, and the log contains an OsgiContainerException with a BundleException as its root cause. For example:

WARNING: Unable to enable plugin ''
com.atlassian.plugin.osgi.container.OsgiContainerException: Cannot start plugin:
       at com.atlassian.plugin.osgi.factory.OsgiPlugin.enableInternal(
       at com.atlassian.plugin.impl.AbstractPlugin.enable(
Caused by: org.osgi.framework.BundleException: Unable to resolve due to constraint violation.
       at org.apache.felix.framework.Felix._resolveBundle(
       at org.apache.felix.framework.Felix._startBundle(
       at org.apache.felix.framework.Felix.startBundle(
       at org.apache.felix.framework.BundleImpl.start(


If your plugin is failing to enable with the message "Unable to resolve due to constraint violation." but doesn't specify a particular package or what the constraint violation is, it's possible that the exporter of a package that you are importing is imposing a uses constraint directive that your plugin is not satisfying. You may need to add a <Package-Import> to your own plugin to satisfy this directive.


At the moment, determining which bundle imposes a uses constraint is primarily guesswork. You will need to look through the META-INF/ files of bundles from which you are importing packages looking for uses directives in the Export-Package: section.

For example:

Manifest-Version: 1.0
Export-Package: com.pyxis.greenhopper;uses:="javax.xml.bind.annotation";version:="4.3.1"
Import-Package: javax.xml.bind.annotation;version="2.1.0"

The uses:="javax.xml.bind.annotation" implies that plugins importing both com.pyxis.greenhopper and javax.xml.bind.annotation must import version "2.1.0" of javax.xml.bind.annotation. This can be achieved by adding the relevant <Package-Import> to your pom.xml:

          javax.xml.bind*;version="2.1.0", <!-- note the specified version String -->

More Information

See also understanding the OSGi uses directive

Rate this page: