在 Eclipse 下编译我的 java 代码后,我收到以下错误消息:
SLF4J:类路径包含多个 SLF4J 绑定。
SLF4J:在 [jar:file:/home/user1/workspace/MC/lib/slf4j-nop-1.5.8.jar!/org/slf4j/impl/StaticLoggerBinder.class] 中找到绑定
SLF4J:在 [jar:file:/home/user1/workspace/stable/lib/org.slf4j/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class] 中找到绑定
我看来两个 slf4j*.jar 文件导致冲突。我尝试从构建的路径中删除一个 jar 文件。单击“构建路径->配置构建路径”,选择“库”选项卡后,我找不到任何与 home/user1/workspace/stable/lib/org.slf4j/slf4j-log4j12-1.6.1.jar 匹配的库”
如果没有这个文件,为什么会造成冲突呢?
After compiling my java code under Eclipse, I got the following error messages:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/user1/workspace/MC/lib/slf4j-nop-1.5.8.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/user1/workspace/stable/lib/org.slf4j/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
t seems to me that the two slf4j*.jar files cause the conflict. I tried to remove one jar file from the built path. After clicking “build path->Configure build path”, selecting the “Libraries” tab, I could not find any library matching home/user1/workspace/stable/lib/org.slf4j/slf4j-log4j12-1.6.1.jar”
If there does not have this file, why it causes conflict?
发布评论
评论(1)
您的构建路径上的另一个 jar 可能包含 slf4j 的版本,该版本与您期望的版本不同。重新排列您的此外,根据 SLF4J 文档,这应该是警告而不是错误。
http://www.slf4j.org/codes.html
您应该能够将 SLF4J 放在库排序的顶部(“配置构建路径”、“排序”和“导出”选项卡),以便您知道它正在使用您期望的版本。然而,我更愿意找到冲突所在并从那里出发。
It could be possible that another jar on your buildpath contains a version of slf4j, which is different than the one you expect. Rearrange your Also, Per SLF4J docs, this should be a warning and not an error.
http://www.slf4j.org/codes.html
You should be able to put the SLF4J on top of your library ordering (Configure build path, Order and Export tab), so that you know it is using the version you expect it to. However, I would prefer finding where the conflict is and proceeding from there.