java Eclipse未能加载类“org.slf4j.impl.StaticLoggerBinder”
Possible Duplicate:
SLF4J: Failed to load class org.slf4j.impl.StaticLoggerBinder error
我使用EclipseJuno运行其他人的Java代码,使用maven(m2eclipse插件)。但我得到了以下信息:
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。jar位于“C:\Program Files\Java\jdk1.7.0\U 07\lib”。但我还是有错误
请指导我什么是正确的解决方案。我是Java新手
另外,请有人指出JAVA_HOME
、CLASSPATH
和CLASS
变量的值应该是什么。我不知道它应该是jre
或jdk
的路径还是任何路径
更新:
项目pom.xml
中存在对slf4j
的以下依赖项
<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依赖项”中。而且org.slf4j.impl.StaticLoggerBinder.class
也存在于slf4j-simple-1.5.6.jar
# 1 楼答案
将jar文件放置到所需位置后,需要通过右键单击添加jar文件
# 2 楼答案
EclipseJuno、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
# 3 楼答案
您是否更新了项目(右键单击项目“Maven”>;“更新项目…”)?否则,您需要检查
pom.xml
是否包含必要的slf4j依赖项,例如: