SLF4J binding error

I am new to maven and for the last two days I have been trying to integrate maven into a small web project. (I use Eclipse Juno as an IDE). First, I generated a new project (structure) using the "mvn-archetype-webapp" command and copied the sources from the project to this structure. Then I added all the dependencies to pom.xml so that I could compile and run the project using the tomcat7 plugin. So far, everything is working fine, except for the SLF4J error messages at the beginning of each maven command:

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. 

My pom.xml dependencies look like this:

  <!-- properties --> <properties> <spring.version>3.1.1.RELEASE</spring.version> </properties> <!-- dependencies --> <dependencies> <!-- logging --> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>1.0.6</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.6.6</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>jcl-over-slf4j</artifactId> <version>1.6.6</version> <scope>runtime</scope> </dependency> <!-- junit --> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> <!-- Spring 3 --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>${spring.version}</version> <exclusions> <exclusion> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>${spring.version}</version> <exclusions> <exclusion> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>${spring.version}</version> <exclusions> <exclusion> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> </exclusion> </exclusions> </dependency> <!-- jee --> <dependency> <groupId>javax</groupId> <artifactId>javaee-web-api</artifactId> <version>6.0</version> <scope>provided</scope> </dependency> <!-- tiles --> <dependency> <groupId>org.apache.tiles</groupId> <artifactId>tiles-core</artifactId> <version>2.2.2</version> </dependency> <dependency> <groupId>org.apache.tiles</groupId> <artifactId>tiles-api</artifactId> <version>2.2.2</version> </dependency> <dependency> <groupId>org.apache.tiles</groupId> <artifactId>tiles-jsp</artifactId> <version>2.2.2</version> </dependency> <!-- jstl --> <dependency> <groupId>jstl</groupId> <artifactId>jstl</artifactId> <version>1.2</version> </dependency> </dependencies> 

Can someone help me with this problem?

+8
maven m2eclipse slf4j
source share
7 answers

Eclipse Juno and Indigo, when using the nested version of maven (m2e), do not suppress the message SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". This behavior is present in version m2e 1.1.0.20120530-0009 and beyond.

Although this is indicated as an error, your logs will be saved normally. The highlighted error will still be present until this error has been fixed. See the m2e support site for more details .

The current available solution is to use an external version of maven, not a bundled version of Eclipse. You can find about this solution and more detailed information about this error in the question below, which is the same problem that you are facing.

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

+8
source share

I have the same problem: I copied my POM into an empty project and reduced it to almost nothing (see below) - and I still see the error. I can confirm that it does not go away by adding SLF4J bindings (logback, etc.) to the POM - the message apparently comes from Maven itself, and not from compiling and testing the project software. (Now I get it from a completely empty project.)

The best thing I can understand is that I think it has something to do with Eclipse: when I start Maven manually, the error does not appear from the command line - only when called in Eclipse. (I use Eclipse Helios Release 2 on MacOSX, just FYI, so we know the problem is not limited to your version, Juno.)

 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>testing</groupId> <artifactId>testing</artifactId> <version>0.0.1-SNAPSHOT</version> </project> 

FYI, in response to Ceki's suggestion, here are the results of the maven dependency tree tree:

 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. [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building testing 0.0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ testing --- [INFO] testing:testing:jar:0.0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.496s [INFO] Finished at: Thu Oct 04 10:05:41 MDT 2012 [INFO] Final Memory: 9M/81M [INFO] ------------------------------------------------------------------------ 

Not too informative, but it is.

+3
source share

This error comes from running eclipse maven, and not from your project, so it should not affect the build process or the resulting files.

I assume this is a maven issue using not slf4j or another logging tool, but eclipse or the maven plugin is trying.

The easiest way to get rid of the error is to use an external maven instead of the runtime in eclipse, which you can configure in Settings -> Maven -> Preferences.

+3
source share

Dependency statements look good. Logback and slf4j will ship in your web application. However, I suspect that slf4j-api.jar is somehow included in Tomcat (but not in logback).

BTW, the mvn dependency:tree command is your friend. What he says?

+1
source share

Try adding a dependency for logback-core.

  <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-core</artifactId> <version>1.0.6</version> <scope>runtime</scope> </dependency> 
0
source share

"with tomcat7 plugin

The tomcat7 plugin has a SLF4J dependency. I had the same problem until I assigned the dependency directly to the tomcat7 plugin.

 <pluginManagement> <plugins> <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.2</version> <dependencies> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-simple</artifactId> <version>1.7.5</version> </dependency> </dependencies> <configuration> <!-- ...snip... --> </configuration> </plugin> </plugins> </pluginManagement> 
0
source share

You can add this to your pom properties.

  <org.slf4j-version>1.7.5</org.slf4j-version> 
-one
source share

All Articles