zoukankan      html  css  js  c++  java
  • spring cloud启动zipkin,报错maven依赖jar包冲突 Class path contains multiple SLF4J bindings

    项目启动报错:

    复制代码
    Connected to the target VM, address: '127.0.0.1:59412', transport: 'socket'
    SLF4J: Class path contains multiple SLF4J bindings.
    SLF4J: Found binding in [jar:file:/D:/document/repository/org/apache/logging/log4j/log4j-slf4j-impl/2.10.0/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
    SLF4J: Found binding in [jar:file:/D:/document/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.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 [org.apache.logging.slf4j.Log4jLoggerFactory]
    Exception in thread "main" java.lang.StackOverflowError
    复制代码

    解决方案:

    直接看报错内容,可以看出  是log4j和logback-classic的jar包冲突。

    最简单的解决方法:将最新添加的jar包依赖,依次删除,然后启动服务,查看是因为多增加了哪个jar包依赖之后,出现的jar包冲突问题。

    找到之后,在pom.xml中排除掉即可:

    复制代码
    <!-- zipkin服务端 -->
            <dependency>
                <groupId>io.zipkin.java</groupId>
                <artifactId>zipkin-server</artifactId>
                <version>2.10.1</version>
                <!--排除-->
                <exclusions>
                    <exclusion>
                        <groupId>org.apache.logging.log4j</groupId>
                        <artifactId>log4j-slf4j-impl</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
    复制代码

    当然,排除的过程也可能依旧报错,那你得看看是你新加的这个jar包里面是多依赖了报错的jar包里的哪一个。

    注意也可能是

    复制代码
       <!--排除-->
        <exclusions>
             <exclusion> 
             <groupId>ch.qos.logback</groupId>
             <artifactId>logback-classic</artifactId>
            </exclusion>
        </exclusions>
    复制代码

    注意:

    <groupId>对应上方错误中的红色
    <artifactId>对应上方错误中的蓝色
  • 相关阅读:
    MySql 用户 及权限操作
    MAC 重置MySQL root 密码
    在mac系统安装Apache Tomcat的详细步骤[转]
    Maven:mirror和repository 区别
    ES6 入门系列
    转场动画CALayer (Transition)
    OC 异常处理
    Foundation 框架
    Enum枚举
    Invalid App Store Icon. The App Store Icon in the asset catalog in 'xxx.app' can’t be transparent nor contain an alpha channel.
  • 原文地址:https://www.cnblogs.com/xc-chejj/p/11344621.html
Copyright © 2011-2022 走看看