Java SLF4J:类路径包含多个SLF4J绑定;排除slf4j

Java SLF4J:类路径包含多个SLF4J绑定;排除slf4j,java,maven,slf4j,openimaj,Java,Maven,Slf4j,Openimaj,我正在尝试使用OpenIMAJ加载视频。它确实显示视频,但始终显示此错误: SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/C:/Users/MaryLu/.m2/repository/ch/qos/logback/logback-classic/1.0.0/logback-classic-1.0.0.jar!/org/slf4j/impl/StaticLoggerBin

我正在尝试使用OpenIMAJ加载视频。它确实显示视频,但始终显示此错误:

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/MaryLu/.m2/repository/ch/qos/logback/logback-classic/1.0.0/logback-classic-1.0.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/MaryLu/.m2/repository/org/slf4j/slf4j-log4j12/1.7.2/slf4j-log4j12-1.7.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.selector.DefaultContextSelector]
16/04/24 20:39:57 INFO xuggle.XuggleVideo: URL file:/F:/workspaceMaven/keyboardcat.flv could not be opened by ffmpeg. Trying to open a stream to the URL instead.
20:39:57.984 [main] DEBUG com.xuggle.xuggler - Could not open output url: file:/F:/workspaceMaven/keyboardcat.flv (../../../../../../../csrc/com/xuggle/xuggler/Container.cpp:436)

我已经检查了类似的问题,但我没有设法解决这个问题。如果我理解的话,我需要在我的
POM.xml
中的某个地方排除slf4j,但我真的不知道在哪个依赖项中。

slf4j消息只是告诉您您的slf4j配置已损坏,因此它会返回到默认配置


真正的问题是,您的URL没有像您预期的那样指向本地文件,因为它已损坏,因此尝试使用它的代码失败。导致中断的一个可能原因可能是您已经在某个位置打开了该文件,因此Windows不允许覆盖该文件。

您的日志文件中已经给出了答案。按照教程进行操作

如上所述

运行
mvn dependency:tree
并搜索哪个依赖项具有您不想要的slf4j实现,然后使用依赖项排除来排除它们,如:

<dependency>
    <groupId>org.someexternallib</groupId>
    <artifactId>someexternallibartifact</artifactId>
    <version>...</version>

    <exclusions>
       <exclusion> 
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-log4j12</artifactId>
       </exclusion>
       <exclusion> 
          <groupId>log4j</groupId>
          <artifactId>log4j</artifactId>
      </exclusion>
    </exclusions> 
</dependency>

org.someexternallib
某个外在的事实
...
org.slf4j
slf4j-log4j12
log4j
log4j

回归经典
回写
slf4j简单
org.slf4j
为了找到使用上述工件的依赖项,请通过 “$mvn依赖项:树”
一旦你发现了这一点,就把上面的排除放在相应的依赖项上。这应该可以解决问题,我想说的是,注意特定的依赖关系

我的问题是,我似乎找不到正确的依赖项,或者我写错了,因为它不起作用
          <exclusion>
            <artifactId>logback-classic</artifactId>
            <groupId>ch.qos.logback</groupId>
          </exclusion>

          <exclusion>
                <artifactId>slf4j-simple</artifactId>
                <groupId>org.slf4j</groupId>
            </exclusion>