0

I want to run maven project using Eclipse Indigo but when i run the project Run As->Maven Install, Initially the message appearing in red color as follow:

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 researched about it and later realized that the slf4j dependencies were also missing. I downloaded slf4j-1.7.5.zip and extract following files in to the C:\Program Files\Java\jdk1.7.0_17\lib :

slf4j-simple-1.7.5.jar, slf4j-api-1.7.5.jar, log4j-over-slf4j-1.7.5.jar .

And also add dependencies in to POM.xml and now pom.xml looks like follows:

<?xml version="1.0" encoding="UTF-8"?>
<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>org.beginningee6.book</groupId>
    <artifactId>chapter10</artifactId>
    <packaging>war</packaging>
    <version>2.0</version>
    <name>Chapter 10 - JSF</name>

    <parent>
        <groupId>org.beginningee6.book</groupId>
        <artifactId>chapters</artifactId>
        <version>2.0</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>javax.persistence</artifactId>
            <version>${javax.persistence-version}</version>
        </dependency>
        <dependency>
   <groupId>org.slf4j</groupId>
   <artifactId>slf4j-simple</artifactId>
   <version>1.7.5</version>
   <scope>compile</scope>
</dependency>

        <dependency>
   <groupId>org.slf4j</groupId>
   <artifactId>slf4j-api</artifactId>
   <version>1.7.5</version>
   <scope>compile</scope>
</dependency>
<dependency>
   <groupId>org.slf4j</groupId>
   <artifactId>log4j-over-slf4j</artifactId>
   <version>1.7.5</version>
   <scope>compile</scope>
</dependency>

        <dependency>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>eclipselink</artifactId>
            <version>${eclipselink-version}</version>
        </dependency>
        <dependency>
            <groupId>javax.faces</groupId>
            <artifactId>jsf-api</artifactId>
            <version>${jsf-version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.glassfish</groupId>
            <artifactId>javax.ejb</artifactId>
            <version>${glassfish-version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.derby</groupId>
            <artifactId>derbyclient</artifactId>
            <version>10.6.2.1</version>
        </dependency>

        <dependency>
            <groupId>org.apache.derby</groupId>
            <artifactId>derby</artifactId>
            <version>10.6.2.1</version>
            <!--<scope>test</scope>-->
        </dependency>
        <dependency>
            <groupId>org.glassfish.extras</groupId>
            <artifactId>glassfish-embedded-all</artifactId>
            <version>3.1.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>

Eventually, i update project and again run it and still the same message is appearing.

Any help will be highly appreciated.

RK.
  • 973
  • 5
  • 19
  • 45

2 Answers2

3

First of all you should remove the dependency of slf4j-api as long as the slf4j-api is bundled with the log4j-over-slf4j dependency. Check you Dependency Hierarchy tab(in the pom.xml) and you will see slf4j-api there under log4j-over-slf4j.

Moreover, there is no need to add any of these files( slf4j-simple-1.7.5.jar, slf4j-api-1.7.5.jar and log4j-over-slf4j-1.7.5.jar) in the lib folder as long as you provide them in your pom.xml. Maven automatically adds EVERY dependency listed in your pom.xml and all the required jars needed by you application in the systems classpath.

<dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-log4j12</artifactId>
       <version></version>
       <scope>compile</scope>
</dependency>

Secondly, as long as you provide the dependency and you still get the SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder" that means that you are facing an m2e bug.

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 the same problem you are facing.

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

Community
  • 1
  • 1
Konstantinos Margaritis
  • 3,237
  • 3
  • 22
  • 32
0

This warning messages only effects the Maven build process! It does not effect your application! So if you want to dismiss this warning, you must Maven (probably the one integrated into Eclipse) force to use SLF4J.

Philip Helger
  • 1,814
  • 18
  • 28