Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SLF4J Binding Error

Im am new to maven and the last two days i try to integrate maven into a small web project. (I use Eclipse Juno as IDE). First I generated a new project (structure) with the "mvn-archetype-webapp" command and copied the sources from the project into this structure. Then I added all dependencies to the pom.xml so that I could compile and start the project with the tomcat7 plugin. So far everything works fine except the SLF4J Error Messages at the start of every 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 looks 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 somebody help me with this issue?

like image 296
M.G. Avatar asked Jul 05 '12 15:07

M.G.


Video Answer


2 Answers

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

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

like image 53
Konstantinos Margaritis Avatar answered Oct 13 '22 19:10

Konstantinos Margaritis


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

I assume this is a problem relating to maven using not slf4j or another logging tool, but eclipse or a maven plugin tries to.

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

like image 45
Alex Lehmann Avatar answered Oct 13 '22 21:10

Alex Lehmann