'org.osgi.framework.BundleException' problems when loading plugins due to class loading

Still need help?

The Atlassian Community is here for you.

Ask the community

Problem

Some plugins don't load at startup. Depending on which plugins are affected, you may see some elements of the user interface malfunctioning.

Diagnosis

The following appears in the atlassian-confluence.log (cause 1):

[5/26/09 15:20:32:143 EDT] 0000001a FelixOsgiCont E com.atlassian.plugin.osgi.container.felix.FelixOsgiContainerManager$BundleRegistration$1 frameworkEvent Framework error in bundle com.springsource.slf4j.api
                                 org.osgi.framework.BundleException: Unresolved constraint in bundle 3: package; (&(package=org.apache.log4j)(version>=1.2.15)(!(version>=2.0.0)))
	at org.apache.felix.framework.Felix._resolveBundle(Felix.java:1725)
	at org.apache.felix.framework.Felix._startBundle(Felix.java:1588)
	at org.apache.felix.framework.Felix.startBundle(Felix.java:1541)
	at org.apache.felix.framework.Felix.setFrameworkStartLevel(Felix.java:1135)
	at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:267)
	at java.lang.Thread.run(Thread.java:810)

The following appears in the atlassian-confluence.log (cause 2):

2013-08-11 00:23:31,541 ERROR [main] [plugin.osgi.factory.OsgiPlugin] enableInternal Detected an error (BundleException) enabling the plugin 'org.randombits.support.confluence' : Unresolved constraint in bundle org.randombits.support.confluence [186]: Unable to resolve 186.0: missing requirement [186.0] package; (&(package=com.atlassian.confluence.content.render.xhtml)(version>=4.0.0)(!(version>=5.0.0))).  This error usually occurs when your plugin imports a package from another bundle with a specific version constraint and either the bundle providing that package doesn't meet those version constraints, or there is no bundle available that provides the specified package. For more details on how to fix this, see http://confluence.atlassian.com/x/1xy6D

You can extend the debugging a bit by adding this line to the log4j.properties:

log4j.logger.com.atlassian.plugin=DEBUG

This will print the list of packages that confluence exports.

Cause

  1. An incorrect JAR file is loaded, preventing other plugins with dependencies from loading
  2. The plugin cache has become corrupted

Resolution

Cause 1

Search the logs for the text org.osgi.framework.BundleException: Unresolved constraint in bundle. After that text, find the conflicting package. In the example above, it's the log4j.jar file, loaded from elsewhere on the classpath. Make sure you don't have duplicates on the classpath and the right classloader configuration.

Refer also to Plugin loading strategies in Confluence and How to manually remove malfunctioning add-ons.

Cause 2

Refer to How to clear Confluence plugins cache to clean the plugins cache.

Last modified on Mar 30, 2016

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.