org.slf4j.impl.StaticLoggerBinder.SINGLETON

I'm unable to create a bugzilla account at http://bugzilla.slf4j.org/createaccount.cgi Could someone enter this bug report for me? If I change my version of logback to 0.9.11 I don't get this. I get it when I use logback version 0.9.13. I'm using version 1.5.5 of slf4j. Thanks Running TestSuite org.apache.maven.surefire.booter.SurefireExecutionException: Cannot instantiate class edu.berkeley.ist.cars.net.email.EmailTest; nested exception is org.testng.TestNGException: Cannot instantiate class edu.berkeley.ist.cars.net.email.EmailTest org.testng.TestNGException: Cannot instantiate class edu.berkeley.ist.cars.net.email.EmailTest at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:35) at org.testng.internal.ClassHelper.createInstance(ClassHelper.java:330) at org.testng.internal.ClassImpl.getDefaultInstance(ClassImpl.java:62) at org.testng.internal.ClassImpl.getInstances(ClassImpl.java:81) at org.testng.internal.TestNGClassFinder.<init>(TestNGClassFinder.java:114) at org.testng.TestRunner.initMethods(TestRunner.java:281) at org.testng.TestRunner.init(TestRunner.java:227) at org.testng.TestRunner.init(TestRunner.java:189) at org.testng.TestRunner.<init>(TestRunner.java:138) at org.testng.SuiteRunner$DefaultTestRunnerFactory.newTestRunner(SuiteRunner.java:477) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:244) at org.testng.SuiteRunner.run(SuiteRunner.java:198) at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:821) at org.testng.TestNG.runSuitesLocally(TestNG.java:788) at org.testng.TestNG.run(TestNG.java:708) at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:62) at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:141) at org.apache.maven.surefire.Surefire.run(Surefire.java:177) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:338) at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:997) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:494) at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:26) ... 23 more Caused by: java.lang.IllegalAccessError: tried to access field org.slf4j.impl.StaticLoggerBinder.SINGLETON from class org.slf4j.LoggerFactory at org.slf4j.LoggerFactory.staticInitialize(LoggerFactory.java:83) at org.slf4j.LoggerFactory.<clinit>(LoggerFactory.java:73) at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:155) at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:131) at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:272) at org.springframework.test.context.testng.AbstractTestNGSpringContextTests.<init>(AbstractTestNGSpringContextTests.java:77) at edu.berkeley.ist.cars.net.email.EmailTest.<init>(EmailTest.java:21) ... 28 more

Upgrading to slf4j 1.5.6 fixes the problem for me. I just discovered that 1.5.6 is available. Rusty Wright wrote:
I'm unable to create a bugzilla account at http://bugzilla.slf4j.org/createaccount.cgi
Could someone enter this bug report for me?
If I change my version of logback to 0.9.11 I don't get this. I get it when I use logback version 0.9.13. I'm using version 1.5.5 of slf4j.
Thanks
Running TestSuite org.apache.maven.surefire.booter.SurefireExecutionException: Cannot instantiate class edu.berkeley.ist.cars.net.email.EmailTest; nested exception is org.testng.TestNGException: Cannot instantiate class edu.berkeley.ist.cars.net.email.EmailTest org.testng.TestNGException: Cannot instantiate class edu.berkeley.ist.cars.net.email.EmailTest at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:35)
at org.testng.internal.ClassHelper.createInstance(ClassHelper.java:330) at org.testng.internal.ClassImpl.getDefaultInstance(ClassImpl.java:62) at org.testng.internal.ClassImpl.getInstances(ClassImpl.java:81) at org.testng.internal.TestNGClassFinder.<init>(TestNGClassFinder.java:114) at org.testng.TestRunner.initMethods(TestRunner.java:281) at org.testng.TestRunner.init(TestRunner.java:227) at org.testng.TestRunner.init(TestRunner.java:189) at org.testng.TestRunner.<init>(TestRunner.java:138) at org.testng.SuiteRunner$DefaultTestRunnerFactory.newTestRunner(SuiteRunner.java:477)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:244) at org.testng.SuiteRunner.run(SuiteRunner.java:198) at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:821) at org.testng.TestNG.runSuitesLocally(TestNG.java:788) at org.testng.TestNG.run(TestNG.java:708) at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:62) at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:141)
at org.apache.maven.surefire.Surefire.run(Surefire.java:177) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:338)
at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:997)
Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494) at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:26)
... 23 more Caused by: java.lang.IllegalAccessError: tried to access field org.slf4j.impl.StaticLoggerBinder.SINGLETON from class org.slf4j.LoggerFactory at org.slf4j.LoggerFactory.staticInitialize(LoggerFactory.java:83) at org.slf4j.LoggerFactory.<clinit>(LoggerFactory.java:73) at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:155)
at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:131)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:272) at org.springframework.test.context.testng.AbstractTestNGSpringContextTests.<init>(AbstractTestNGSpringContextTests.java:77)
at edu.berkeley.ist.cars.net.email.EmailTest.<init>(EmailTest.java:21) ... 28 more

I'm using the underneath listed dependencies and I'm receiving the same error message: "java.lang.reflect.InvocationTargetException: java.lang.IllegalAccessError: tried to access field org.slf4j.impl.StaticLoggerBinder.SINGLETON from class org.slf4j.LoggerFactory". What could I do to correct this ? <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.6.3</version> </dependency> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-core</artifactId> <version>0.9.30</version> </dependency> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>0.9.30</version> </dependency> Rusty Wright-2 wrote:
Upgrading to slf4j 1.5.6 fixes the problem for me. I just discovered that 1.5.6 is available.
Rusty Wright wrote:
I'm unable to create a bugzilla account at http://bugzilla.slf4j.org/createaccount.cgi
Could someone enter this bug report for me?
If I change my version of logback to 0.9.11 I don't get this. I get it when I use logback version 0.9.13. I'm using version 1.5.5 of slf4j.
Thanks
Running TestSuite org.apache.maven.surefire.booter.SurefireExecutionException: Cannot instantiate class edu.berkeley.ist.cars.net.email.EmailTest; nested exception is org.testng.TestNGException: Cannot instantiate class edu.berkeley.ist.cars.net.email.EmailTest org.testng.TestNGException: Cannot instantiate class edu.berkeley.ist.cars.net.email.EmailTest at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:35)
at org.testng.internal.ClassHelper.createInstance(ClassHelper.java:330) at org.testng.internal.ClassImpl.getDefaultInstance(ClassImpl.java:62) at org.testng.internal.ClassImpl.getInstances(ClassImpl.java:81) at org.testng.internal.TestNGClassFinder.<init>(TestNGClassFinder.java:114) at org.testng.TestRunner.initMethods(TestRunner.java:281) at org.testng.TestRunner.init(TestRunner.java:227) at org.testng.TestRunner.init(TestRunner.java:189) at org.testng.TestRunner.<init>(TestRunner.java:138) at org.testng.SuiteRunner$DefaultTestRunnerFactory.newTestRunner(SuiteRunner.java:477)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:244) at org.testng.SuiteRunner.run(SuiteRunner.java:198) at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:821) at org.testng.TestNG.runSuitesLocally(TestNG.java:788) at org.testng.TestNG.run(TestNG.java:708) at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:62) at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:141)
at org.apache.maven.surefire.Surefire.run(Surefire.java:177) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:338)
at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:997)
Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494) at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:26)
... 23 more Caused by: java.lang.IllegalAccessError: tried to access field org.slf4j.impl.StaticLoggerBinder.SINGLETON from class org.slf4j.LoggerFactory at org.slf4j.LoggerFactory.staticInitialize(LoggerFactory.java:83) at org.slf4j.LoggerFactory.<clinit>(LoggerFactory.java:73) at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:155)
at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:131)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:272) at org.springframework.test.context.testng.AbstractTestNGSpringContextTests.<init>(AbstractTestNGSpringContextTests.java:77)
at edu.berkeley.ist.cars.net.email.EmailTest.<init>(EmailTest.java:21) ... 28 more
Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user
-- View this message in context: http://old.nabble.com/org.slf4j.impl.StaticLoggerBinder.SINGLETON-tp20987705... Sent from the Logback User mailing list archive at Nabble.com.

FYI, given Maven's transitive dependency rules, writing: <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>0.9.30</version> </dependency> is equivalent to writing: <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.6.3</version> </dependency> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-core</artifactId> <version>0.9.30</version> </dependency> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>0.9.30</version> </dependency> As for your actual question, you most probably have an earlier version of slf4j on your class path. Check your dependency tree with the command 'mvn dependency:tree'. Also note that Weld bundles SLF4J within itself. -- Ceki http://twitter.com/#!/ceki On 25/10/2011 12:34 PM, stlecho wrote:
I'm using the underneath listed dependencies and I'm receiving the same error message: "java.lang.reflect.InvocationTargetException: java.lang.IllegalAccessError: tried to access field org.slf4j.impl.StaticLoggerBinder.SINGLETON from class org.slf4j.LoggerFactory".
What could I do to correct this ?
<dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.6.3</version> </dependency> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-core</artifactId> <version>0.9.30</version> </dependency> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>0.9.30</version> </dependency>

You're correct. I'm having 2 maven repositories and had a mix of incompatible logback and slf4j versions. The problem is solved. Thanks for your support :-) Ceki Gulcu wrote:
FYI, given Maven's transitive dependency rules, writing:
<dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>0.9.30</version> </dependency>
is equivalent to writing:
<dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.6.3</version> </dependency> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-core</artifactId> <version>0.9.30</version> </dependency> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>0.9.30</version> </dependency>
As for your actual question, you most probably have an earlier version of slf4j on your class path. Check your dependency tree with the command 'mvn dependency:tree'. Also note that Weld bundles SLF4J within itself.
-- Ceki http://twitter.com/#!/ceki
On 25/10/2011 12:34 PM, stlecho wrote:
I'm using the underneath listed dependencies and I'm receiving the same error message: "java.lang.reflect.InvocationTargetException: java.lang.IllegalAccessError: tried to access field org.slf4j.impl.StaticLoggerBinder.SINGLETON from class org.slf4j.LoggerFactory".
What could I do to correct this ?
<dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.6.3</version> </dependency> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-core</artifactId> <version>0.9.30</version> </dependency> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>0.9.30</version> </dependency>
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://mailman.qos.ch/mailman/listinfo/logback-user
-- View this message in context: http://old.nabble.com/org.slf4j.impl.StaticLoggerBinder.SINGLETON-tp20987705... Sent from the Logback User mailing list archive at Nabble.com.

However, if you are using SLF4J as the facade and Logback purely as an implementation it's best practice to declare SLF4J as a compile time dependency and Logback as a runtime one - that will save you from accidentally depending on a Logback specific class. Even if you need to compile against Logback it's best practice to specify any other libraries (such as SLF4J) you need on the compile time classpath explicitly rather than relying on transitive dependencies - it's kind of a mistake in Maven that transitive compile scope dependencies are brought in as compile scope, they should really only be runtime scope. On 25 Oct 2011, at 11:41, ceki <ceki@qos.ch> wrote:
FYI, given Maven's transitive dependency rules, writing:
<dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>0.9.30</version> </dependency>
is equivalent to writing:
<dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.6.3</version> </dependency> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-core</artifactId> <version>0.9.30</version> </dependency> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>0.9.30</version> </dependency>
participants (4)
-
ceki
-
Robert Elliot
-
Rusty Wright
-
stlecho