Possible Duplicate:
SLF4J: Failed to load class org.slf4j.impl.StaticLoggerBinder error
我正在使用 eclipse juno 使用 maven(m2eclipse 插件)运行其他人的 Java 代码。但我收到以下消息:
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.
在 official website ,我找到了解决此问题的以下方法:
This error is reported when the org.slf4j.impl.StaticLoggerBinder class could not be loaded into memory.
This happens when no appropriate SLF4J binding could be found on the class path.
Placing one (and only one) of slf4j-nop.jar, slf4j-simple.jar, slf4j-log4j12.jar, slf4j-jdk14.jar or logback-classic.jar on the class path should solve the problem.
所以我将 slf4j-simple.jar 复制到 "C:\Program Files\Java\jdk1.7.0_07\lib" 中。但我仍然收到错误。
请指导我什么是正确的解决方案。我是 Java 新手。
也有人可以提一下 JAVA_HOME
、CLASSPATH
和 CLASS
变量的确切值。我很困惑它是否应该是 jre
或 jdk
或任何路径?
更新:
slf4j
的以下依赖项存在于项目 pom.xml
中。
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.5.6</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.5.6</version>
</dependency>
我已经更新了我的项目。 slf4j-api-1.5.6.jar
和 slf4j-simple-1.5.6.jar
也出现在 "Maven dependencies" 中在我的项目中。 org.slf4j.impl.StaticLoggerBinder.class
也存在于 slf4j-simple-1.5.6.jar
最佳答案
Eclipse Juno、Indigo 和 Kepler 在使用捆绑的 maven 版本 (m2e) 时,不会抑制消息 SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder"。此行为从 m2e 版本 1.1.0.20120530-0009 及更高版本开始存在。
虽然,这表示为错误,您的日志将正常保存。在修复此错误之前,突出显示的错误仍将存在。更多信息请查看 m2e support site .
当前可用的解决方案是使用外部 maven 版本而不是 Eclipse 的捆绑版本。您可以在下面的问题中找到有关此解决方案以及有关此错误的更多详细信息,我相信该问题描述了您面临的相同问题。
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". error
关于java - Eclipse - 无法加载类 "org.slf4j.impl.StaticLoggerBinder",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13473953/