繁体   English   中英

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

[英]SLF4J: Class path contains multiple SLF4J bindings; exclude slf4j

我正在尝试使用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,但我真的不知道对哪个依赖项。

答案已在您的日志文件中给出。 按照教程进行。

http://www.slf4j.org/codes.html#multiple_bindings

正如伍特所说

运行mvndependency 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>

slf4j消息只是告诉您slf4j配置已损坏,因此它会恢复为默认配置。

真正的问题是您的URL指向的不是本地文件,这显然是您希望的,因为它已损坏,因此尝试使用它的代码失败。 损坏的可能原因可能是您已经在某个位置打开了文件,因此Windows不允许覆盖它。

          <exclusion>
            <artifactId>logback-classic</artifactId>
            <groupId>ch.qos.logback</groupId>
          </exclusion>

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

为了找到使用上述工件的依赖项,一旦发现将上述排除项放在相应的依赖项上,请通过“ $ mvndependency:tree”进行查找。 那应该解决它,我会说要注意特定的依赖项。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM