spring cloud啓動zipkin,報錯maven依賴jar包衝突 Class path contains multiple SLF4J bindings

項目啓動報錯:html

複製代碼
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
複製代碼

 

 

解決方案:java

直接看報錯內容,能夠看出  是log4j和logback-classic的jar包衝突。apache

 

最簡單的解決方法:將最新添加的jar包依賴,依次刪除,而後啓動服務,查看是由於多增長了哪一個jar包依賴以後,出現的jar包衝突問題。socket

找到以後,在pom.xml中排除掉便可:spa

複製代碼
<!-- 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包裏的哪個。code

注意也多是server

複製代碼
   <!--排除-->
    <exclusions>
         <exclusion> 
         <groupId>ch.qos.logback</groupId>
         <artifactId>logback-classic</artifactId>
        </exclusion>
    </exclusions>
複製代碼

 

注意:xml

<groupId>對應上方錯誤中的紅色
<artifactId>對應上方錯誤中的藍色
相關文章
相關標籤/搜索