• <bdo id='mVYUz'></bdo><ul id='mVYUz'></ul>
  • <small id='mVYUz'></small><noframes id='mVYUz'>

    <tfoot id='mVYUz'></tfoot>

      1. <legend id='mVYUz'><style id='mVYUz'><dir id='mVYUz'><q id='mVYUz'></q></dir></style></legend>
        <i id='mVYUz'><tr id='mVYUz'><dt id='mVYUz'><q id='mVYUz'><span id='mVYUz'><b id='mVYUz'><form id='mVYUz'><ins id='mVYUz'></ins><ul id='mVYUz'></ul><sub id='mVYUz'></sub></form><legend id='mVYUz'></legend><bdo id='mVYUz'><pre id='mVYUz'><center id='mVYUz'></center></pre></bdo></b><th id='mVYUz'></th></span></q></dt></tr></i><div id='mVYUz'><tfoot id='mVYUz'></tfoot><dl id='mVYUz'><fieldset id='mVYUz'></fieldset></dl></div>

      2. 多个 SLF4J 绑定会导致错误?

        Multiple SLF4J bindings cause error?(多个 SLF4J 绑定会导致错误?)
          <tbody id='zOMmS'></tbody>
          • <legend id='zOMmS'><style id='zOMmS'><dir id='zOMmS'><q id='zOMmS'></q></dir></style></legend>

                <i id='zOMmS'><tr id='zOMmS'><dt id='zOMmS'><q id='zOMmS'><span id='zOMmS'><b id='zOMmS'><form id='zOMmS'><ins id='zOMmS'></ins><ul id='zOMmS'></ul><sub id='zOMmS'></sub></form><legend id='zOMmS'></legend><bdo id='zOMmS'><pre id='zOMmS'><center id='zOMmS'></center></pre></bdo></b><th id='zOMmS'></th></span></q></dt></tr></i><div id='zOMmS'><tfoot id='zOMmS'></tfoot><dl id='zOMmS'><fieldset id='zOMmS'></fieldset></dl></div>
                <tfoot id='zOMmS'></tfoot>

                <small id='zOMmS'></small><noframes id='zOMmS'>

                • <bdo id='zOMmS'></bdo><ul id='zOMmS'></ul>
                  本文介绍了多个 SLF4J 绑定会导致错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我的依赖树和多个 SLF4J 绑定有问题.到目前为止,我发现通常这只会导致警告,但在我的情况下,它似乎会阻止我的程序运行:这些是我得到的例外:

                  I have a problem with my dependency tree and multiple SLF4J binding. What I found out so far is that usually this only causes a warning but in my case it seems to prevent my program from running: These are the exceptions I get:

                  SLF4J:类路径包含多个 SLF4J 绑定.SLF4J:在 [jar:file:/C:/Users/FischerNi/.m2/repository/org/slf4j/slf4j-jdk14/1.5.3/slf4j-jdk14-1.5.3.jar!/org/slf4j/中找到绑定impl/StaticLoggerBinder.class]SLF4J:在 [jar:file:/C:/Users/FischerNi/.m2/repository/org/slf4j/slf4j-log4j12/1.6.1/slf4j-log4j12-1.6.1.jar!/org/slf4j/中找到绑定impl/StaticLoggerBinder.class]SLF4J:请参阅 http://www.slf4j.org/codes.html#multiple_bindings 了解一个解释.SLF4J:slf4j-api 1.6.x(或更高版本)与此绑定不兼容.SLF4J:您的绑定是 1.5.5 或更早版本.SLF4J:将您的绑定升级到版本 1.6.x.或 2.0.x线程主"java.lang.NoSuchMethodError 中的异常:org.slf4j.impl.StaticLoggerBinder.getSingleton()Lorg/slf4j/impl/StaticLoggerBinder;

                  SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/C:/Users/FischerNi/.m2/repository/org/slf4j/slf4j-jdk14/1.5.3/slf4j-jdk14-1.5.3.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/C:/Users/FischerNi/.m2/repository/org/slf4j/slf4j-log4j12/1.6.1/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. SLF4J: slf4j-api 1.6.x (or later) is incompatible with this binding. SLF4J: Your binding is version 1.5.5 or earlier. SLF4J: Upgrade your binding to version 1.6.x. or 2.0.x Exception in thread "main" java.lang.NoSuchMethodError: org.slf4j.impl.StaticLoggerBinder.getSingleton()Lorg/slf4j/impl/StaticLoggerBinder;

                  这是我依赖项的相关部分:网络.lightbody.bmpbrowsermob 代理2.0-beta-8

                  and this is the relevant piece of my dependencies: net.lightbody.bmp browsermob-proxy 2.0-beta-8

                      <!-- LOGGING DEPENDENCIES - LOG4J -->
                      <dependency>
                          <groupId>org.slf4j</groupId>
                          <artifactId>slf4j-api</artifactId>
                      </dependency>
                  
                      <dependency>
                          <groupId>org.slf4j</groupId>
                          <artifactId>slf4j-log4j12</artifactId>
                      </dependency>
                  

                  谁能告诉我如何解决这个问题?

                  Can somebody please tell me how to resolve this issue?

                  推荐答案

                  有几个解决方案:

                  • 确保只包含一个 slf4j jar(可能使用更高版本),如果您的类路径中有几个不同版本的 jar.
                  • 有时可能无法排除多个 slf4j jar,因为它们可能会被您的类路径上的其他 jar 内部使用.这些依赖的 jar 可能会引用不同版本的 slf4j jar,这会导致您的应用程序失败.在这种情况下,请确保在使用 SLF4J jar 的其他 jar 之前添加了具有更高版本 SLF4j 的 jar.这将确保您的 java 程序将选择最新版本的 SLF4J,这显然是向后兼容的.
                  • Make sure that you include only one slf4j jar(probably with the higher version) if you have couple of them with different versions on your class path.
                  • Sometimes it may not be possible to exclude multiple slf4j jars, as they may be used by other jars internally, which are on your class path. These dependent jar may refer to different versions of slf4j jars which causes your application to fail. In such cases, make sure that you have the jar with higher version of SLF4j added before other jar using SLF4J jars. This will make sure that your java program will pick up the latest version of the SLF4J which obviously is backward compatible.

                  这篇关于多个 SLF4J 绑定会导致错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Maven JAVA_HOME environment variable is not defined correctly, but it is(Maven JAVA_HOME 环境变量未正确定义,但它是)
                  Java System Environment Variable(Java 系统环境变量)
                  Java -classpath option(Java -classpath 选项)
                  Read environment variable in SpringBoot(在 SpringBoot 中读取环境变量)
                  Tomcat 8 - context.xml use Environment Variable in Datasource(Tomcat 8 - context.xml 在数据源中使用环境变量)
                  Issue with JAVA_HOME(JAVA_HOME 的问题)
                  <legend id='wUmt8'><style id='wUmt8'><dir id='wUmt8'><q id='wUmt8'></q></dir></style></legend>
                  • <bdo id='wUmt8'></bdo><ul id='wUmt8'></ul>

                    <i id='wUmt8'><tr id='wUmt8'><dt id='wUmt8'><q id='wUmt8'><span id='wUmt8'><b id='wUmt8'><form id='wUmt8'><ins id='wUmt8'></ins><ul id='wUmt8'></ul><sub id='wUmt8'></sub></form><legend id='wUmt8'></legend><bdo id='wUmt8'><pre id='wUmt8'><center id='wUmt8'></center></pre></bdo></b><th id='wUmt8'></th></span></q></dt></tr></i><div id='wUmt8'><tfoot id='wUmt8'></tfoot><dl id='wUmt8'><fieldset id='wUmt8'></fieldset></dl></div>

                              <tbody id='wUmt8'></tbody>

                          • <tfoot id='wUmt8'></tfoot>

                            <small id='wUmt8'></small><noframes id='wUmt8'>