NoClassDefFoundError:org/slf4j/impl/StaticLoggerBinder [英] NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder

查看:92
本文介绍了NoClassDefFoundError:org/slf4j/impl/StaticLoggerBinder的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试运行给出下面是我的POM.xml:

Below is my POM.xml:

<dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-api</artifactId>
            <version>2.1.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-core</artifactId>
            <version>2.1.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-jsp</artifactId>
            <version>2.1.2</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.5.2</version>
        </dependency>

当我尝试运行示例时,抛出以下错误:

When I'm trying to run the example the below error is thrown:

Sep 17, 2010 11:59:43 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Error configuring application listener of class      org.apache.tiles.web.startup.TilesListener
java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder
at org.slf4j.LoggerFactory.<clinit>(LoggerFactory.java:60)
at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:155)
at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:131)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:685)
at org.apache.tiles.web.startup.TilesListener.<init>(TilesListener.java:49)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)

有什么主意吗?

为此花了30分钟,但无法找到可能的解决方法.

I spent 30 minutes googling for this but could not find a possible sollution.

请帮助我...

推荐答案

您已包括对SLF4J API的依赖关系,这是您在应用程序中用于日志记录的依赖,但是您还必须包括一个执行实际日志记录的实现工作.

You have included a dependency on the SLF4J API, which is what you use in your application for logging, but you must also include an implementation that does the real logging work.

例如,要通过Log4J登录,您可以添加以下依赖项:

For example to log through Log4J you would add this dependency:

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

推荐的实现方式应为logback-classic,它是Log4j的后继产品,它是由制造SLF4J和Log4J的人制造的:

The recommended implementation would be logback-classic, which is the successor of Log4j, made by the same guys that made SLF4J and Log4J:

<dependency>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-classic</artifactId>
    <version>0.9.24</version>
</dependency>

注意:版本可能不正确.

Note: The versions may be incorrect.

这篇关于NoClassDefFoundError:org/slf4j/impl/StaticLoggerBinder的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆