gpt4 book ai didi

java - NoClassDefFoundError : org/slf4j/impl/StaticLoggerBinder

转载 作者:IT老高 更新时间:2023-10-28 20:40:42 25 4
gpt4 key购买 nike

我正在尝试运行 here 给出的示例图 block 示例.

下面是我的 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>

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

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 分钟在谷歌上搜索,但找不到可能的解决方案。

请帮帮我...

最佳答案

您已经包含了对 SLF4J API 的依赖,这是您在应用程序中用于记录的,但您还必须包含一个执行真正记录工作的实现。

例如,要通过 Log4J 登录,您将添加此依赖项:

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

推荐的实现是 logback-classic,它是 Log4j 的继承者,由制作 SLF4J 和 Log4J 的同一个人制作:

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

注意:版本可能不正确。

关于java - NoClassDefFoundError : org/slf4j/impl/StaticLoggerBinder,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3737992/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com