I'm seeing the following in my stash log (standalone, local) when using `atlas-install-plugin` for a newly created plugin:
2014-01-21 17:12:48,204 WARN [UpmAsynchronousTaskManager:thread-2] admin 1032x8x0 1blz4pw 127.0.0.1 "POST /rest/plugins/1.0/ HTTP/1.1" c.a.p.u.r.AlternativeDirectoryResourceLoader Resource directory , which resolves to /private/tmp/amps-standalone/target/container/tomcat7x/cargo-stash-home does not exist 2014-01-21 17:12:48,264 ERROR [ThreadPoolAsyncTaskExecutor::Thread 16] admin 1032x8x0 1blz4pw 127.0.0.1 "POST /rest/plugins/1.0/ HTTP/1.1" c.a.plugin.osgi.factory.OsgiPlugin Unable to start the plugin container for plugin com.squareup.stash.group-mention-plugin org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'PullRequestListener' defined in URL [bundle://96.0:0/META-INF/spring/atlassian-plugins-components.xml]: Instantiation of bean failed; nested exception is java.lang.LinkageError: loader constraint violation: when resolving method "org.slf4j.impl.StaticLoggerBinder.getLoggerFactory()Lorg/slf4j/ILoggerFactory;" the class loader (instance of org/apache/felix/framework/ModuleImpl$ModuleClassLoaderJava5) of the current class, org/slf4j/LoggerFactory, and the class loader (instance of org/apache/catalina/loader/WebappClassLoader) for resolved class, org/slf4j/impl/StaticLoggerBinder, have different Class objects for the type org/slf4j/ILoggerFactory used in the signature at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:254) ~[spring-beans-3.2.5.RELEASE.jar:3.2.5.RELEASE] at java.security.AccessController.doPrivileged(Native Method) ~[na:1.6.0_65] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728) ~[spring-context-3.2.5.RELEASE.jar:3.2.5.RELEASE] at java.lang.Thread.run(Thread.java:695) ~[na:1.6.0_65] ... 18 frames trimmed Caused by: java.lang.LinkageError: loader constraint violation: when resolving method "org.slf4j.impl.StaticLoggerBinder.getLoggerFactory()Lorg/slf4j/ILoggerFactory;" the class loader (instance of org/apache/felix/framework/ModuleImpl$ModuleClassLoaderJava5) of the current class, org/slf4j/LoggerFactory, and the class loader (instance of org/apache/catalina/loader/WebappClassLoader) for resolved class, org/slf4j/impl/StaticLoggerBinder, have different Class objects for the type org/slf4j/ILoggerFactory used in the signature at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:299) ~[slf4j-api-1.7.5.jar:1.7.5] at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:269) ~[slf4j-api-1.7.5.jar:1.7.5] at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:281) ~[slf4j-api-1.7.5.jar:1.7.5] at com.squareup.stash.PullRequestListener.<clinit>(PullRequestListener.java:19) ~[na:na] at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:100) ~[spring-beans-3.2.5.RELEASE.jar:3.2.5.RELEASE] ... 4 common frames omitted 2014-01-21 17:12:48,268 ERROR [ThreadPoolAsyncTaskExecutor::Thread 16] admin 1032x8x0 1blz4pw 127.0.0.1 "POST /rest/plugins/1.0/ HTTP/1.1" o.s.o.e.i.a.ContextLoaderListener Application context refresh failed (NonValidatingOsgiBundleXmlApplicationContext(bundle=com.squareup.stash.group-mention-plugin, config=osgibundle:/META-INF/spring/*.xml)) org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'PullRequestListener' defined in URL [bundle://96.0:0/META-INF/spring/atlassian-plugins-components.xml]: Instantiation of bean failed; nested exception is java.lang.LinkageError: loader constraint violation: when resolving method "org.slf4j.impl.StaticLoggerBinder.getLoggerFactory()Lorg/slf4j/ILoggerFactory;" the class loader (instance of org/apache/felix/framework/ModuleImpl$ModuleClassLoaderJava5) of the current class, org/slf4j/LoggerFactory, and the class loader (instance of org/apache/catalina/loader/WebappClassLoader) for resolved class, org/slf4j/impl/StaticLoggerBinder, have different Class objects for the type org/slf4j/ILoggerFactory used in the signature at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:254) ~[spring-beans-3.2.5.RELEASE.jar:3.2.5.RELEASE] at java.security.AccessController.doPrivileged(Native Method) ~[na:1.6.0_65] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728) ~[spring-context-3.2.5.RELEASE.jar:3.2.5.RELEASE] at java.lang.Thread.run(Thread.java:695) [na:1.6.0_65] ... 18 frames trimmed Caused by: java.lang.LinkageError: loader constraint violation: when resolving method "org.slf4j.impl.StaticLoggerBinder.getLoggerFactory()Lorg/slf4j/ILoggerFactory;" the class loader (instance of org/apache/felix/framework/ModuleImpl$ModuleClassLoaderJava5) of the current class, org/slf4j/LoggerFactory, and the class loader (instance of org/apache/catalina/loader/WebappClassLoader) for resolved class, org/slf4j/impl/StaticLoggerBinder, have different Class objects for the type org/slf4j/ILoggerFactory used in the signature at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:299) ~[slf4j-api-1.7.5.jar:1.7.5] at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:269) ~[slf4j-api-1.7.5.jar:1.7.5] at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:281) ~[slf4j-api-1.7.5.jar:1.7.5] at com.squareup.stash.PullRequestListener.<clinit>(PullRequestListener.java:19) ~[na:na] at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:100) ~[spring-2.5.6.SEC02.jar:3.2.5.RELEASE] ... 4 common frames omitted
Strangely, I have an old plugin lying around that uses the same logging classes/technique, but which installs fine. (It was created on a much older version of stash/atlas.)
I don't really know how to go about fixing this. Suggestions welcome!
My code:
package com.squareup.stash; import com.atlassian.event.api.EventListener; import com.atlassian.stash.event.pull.PullRequestUpdatedEvent; import org.slf4j.LoggerFactory; import org.slf4j.Logger; public class PullRequestListener { private static final Logger log = LoggerFactory.getLogger(PullRequestListener.class); @EventListener public void myListener(PullRequestUpdatedEvent e) { log.debug("HOLA"); } }
Xavier
Community moderators have prevented the ability to post new answers.
Hi Xavier,
What does your pom.xml look like? Make sure you use <scope>provided</scope> for importing SLF4J, otherwise you're going to run into weird classpath problems.
Cheers,
Charles
I'm not explicitly importing SLF4J ... should I be?
https://gist.github.com/xaviershay/eab492d61998e8462cb5
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Adding the following to my pom appears to have fixed the issue:
<dependency> <groupId>.org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.7.5</version> <scope>provided</scope> </dependency>
... though I don't really understand why.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To add to the confusion Had the same problem. Adding the dependency on slf4j didn't resolve the problem, but changing the source and target version of the compiler did {code} <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> {code}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
(I changed it back from 1.7 to 1.6)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.