Rate this page:
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:
[INFO] [talledLocalContainer] org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/osgi] [INFO] [talledLocalContainer] Offending resource: URL [bundle://28.0:0/META-INF/spring/atlassian-plugins-component-imports.xml]
[INFO] [talledLocalContainer] Caused by: org.springframework.beans.FatalBeanException: Class [org.springframework.osgi.config.OsgiNamespaceHandler] for namespace [http://www.springframework.org/schema/osgi] does not implement the [org.springframework.beans.factory.xml.NamespaceHandler] interface
[INFO] [talledLocalContainer] com.atlassian.util.concurrent.LazyReference$InitializationException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.myplugin.MyFilter': Instantiation of bean failed; nested exception is java.lang.IllegalAccessError: tried to access field org.slf4j.impl.StaticLoggerBinder.SINGLETON from class org.slf4j.LoggerFactory
[INFO] [talledLocalContainer] 2011-01-05 16:30:20,759 ERROR [http-1990-3] [atlassian.plugin.servlet.DefaultServletModuleManager] getFilter Unable to create filter [INFO] [talledLocalContainer] com.atlassian.util.concurrent.LazyReference$InitializationException: java.lang.ClassCastException: com.myplugin.MyFilter cannot be cast to javax.servlet.Filter
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:
To see the list of jars bundled with your plugin, run the following from your plugin directory:
mvn clean package ls target/classes/META-INF/lib/
As a general rule, the only jars listed in 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 element set to in your plugin's . For example:
1 2 3 4 5 6 7 8 9 10
<dependencies> ... <dependency> <groupId>org.springframework.osgi</groupId> <artifactId>spring-osgi-core</artifactId> <version>3.0.5.RELEASE</version> <scope>provided</scope> </dependency> ... </dependencies>
Note that the default scope is , which results in the dependency being bundled with the plugin, so must be specified explicitly. For more information on dependency scopes in Maven, see the documentation for Maven's dependency mechanism.
Rate this page: