Dependency Issues during Plugin Initialisation
On this page:
Symptoms — What Goes Wrong
Your plugin fails to initialize with an error that suggests a dependency problem, such as missing resources or incompatible classes.
The exact symptoms can take many forms - here are a few examples:
The most likely cause is that a resource supplied by the environment in which your plugin is hosted was overridden by a conflicting resource, because the conflicting resource was erroneously bundled in your plugin.
There are a couple of ways you can explore the resources provided by the hosting environment:
- You can use the Universal Plugin Manager which, as of version 1.3, displays the packages exported and imported by each bundle loaded in the environment.
- Similar information can be obtained from the Apache Felix Web Console, which is available at
http://\[your_app_base_URL\]/plugins/servlet/system/consoleif the app was started with the Plugin SDK.
To see the list of jars bundled with your plugin, run the following from your plugin directory:
As a general rule, the only jars listed in
target/classes/META-INF/lib/ should be those specific to your plugin. For example, if the purpose of your plugin is to integrate a 3rd party app, it is reasonable for your plugin to bundle the API library for that app, because that library isn't supplied by any other part of the environment. On the other hand, it is unlikely that your plugin would need to bundle jars related to Spring Framework, logging or javax.servlet, since those are already provided by the plugin platform, the app or the app server.
To resolve this issue, ensure that all dependencies, except those that are unique to your plugin, have their
scope element set to
provided in your plugin's
pom.xml. For example:
Note that the default scope is
compile, which results in the dependency being bundled with the plugin, so
provided must be specified explicitly. For more information on dependency scopes in Maven, see the documentation for Maven's dependency mechanism.
- Big Modular Plugins (presentation from AtlasCamp 2010)
- Maven Dependency Mechanism
- Apache Felix Web Console