SLF4J绑定错误

Mic*_*ler 8 slf4j m2eclipse maven

我是maven的新手,最近两天我尝试将maven集成到一个小型的Web项目中.(我使用Eclipse Juno作为IDE).首先,我使用"mvn-archetype-webapp"命令生成了一个新项目(结构),并将项目中的源代码复制到此结构中.然后我将所有依赖项添加到pom.xml中,以便我可以使用tomcat7插件编译和启动项目.到目前为止,一切正常,除了每个maven命令开头的SLF4J错误消息:

    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.
Run Code Online (Sandbox Code Playgroud)

我的pom.xml依赖项如下所示:

    <!-- 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>
Run Code Online (Sandbox Code Playgroud)

有人可以帮我解决这个问题吗?

Kon*_*tis 8

当使用捆绑的maven版本(m2e)时,Eclipse Juno和Indigo不会抑制消息SLF4J:无法加载类"org.slf4j.impl.StaticLoggerBinder".此行为存在于m2e版本1.1.0.20120530-0009及之后.

虽然,这表示为错误,您的日志将正常保存.在修复此错误之前,突出显示的错误仍然存​​在.有关m2e支持网站的更多信息.

当前可用的解决方案是使用外部maven版本而不是捆绑的Eclipse版本.您可以在下面的问题中找到有关此错误的更多详细信息,以及您遇到的完全相同的问题.

SLF4J:无法加载类"org.slf4j.impl.StaticLoggerBinder".错误