5
votes

Got this error on Eclipse Juno 4.2 when running a maven project.

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

I am not using slf4j for logging. Actually i dont use any logging.

What am i doing wrong.?

The only dependency in my pom.xml

<dependencies>
   <dependency>
     <groupId>junit</groupId>
     <artifactId>junit</artifactId>
     <version>4.10</version>
     <scope>test</scope>
    </dependency>   
</dependencies>

Edit:

mvn dependency:tree

[INFO] \- junit:junit:jar:4.10:test
[INFO]    \- org.hamcrest:hamcrest-core:jar:1.1:test

Edit 2:

I created a New Maven Project-->maven-archetype-quickstart. After that i run clean install and eclipse console shows the above error. I did not even write any part of code yet. Even if i delete the sample src java file and sample test java file it produces the same error.


Edit 3:

I run the project outside of Eclipse and there was no error indication.

3
Well, something is adding slf4j to your classpath. Run 'mvn dependency:tree' to see what.bmargulies
That what it returned the dependency:tree [INFO] \- junit:junit:jar:4.10:test [INFO] \- org.hamcrest:hamcrest-core:jar:1.1:tesjavaG
Then you aren't running what you think you are running. Please edit your question to say exactly what you are doing to get that output, and where you are getting it.bmargulies
i updated the question as suggested. Does it need any more details.??javaG
Any idea of how to resolve the issue..?javaG

3 Answers

7
votes

Eclipse Juno and Indigo, when using the bundled maven version(m2e), are not suppressing the message SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". This behaviour is present from the m2e version 1.1.0.20120530-0009 and onwards.

Although, this is indicated as an error your logs will be saved normally. The highlighted error will still be present until there is a fix of this bug. More about this in the m2e support site.

The current available solution is to use an external maven version rather than the bundled version of Eclipse. You can find about this solution and more details regarding this bug in the question below which i believe describes is the same problem you are facing.

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". error

0
votes

I think it is actually the Maven plugin that is complaining about not having a logger. I believe this is harmless.

0
votes

You can add this dependency:

<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-simple</artifactId>
    <version>1.7.7</version>
</dependency>

Or you can also add slf4j-nop slf4j-log4j12 which I haven't test.