idea項(xiàng)目啟動報(bào)錯,日志包沖突slf4j和logback沖突問題
idea項(xiàng)目啟動報(bào)錯,日志包沖突slf4j和logback沖突
報(bào)錯如下
SLF4J: Found binding in [jar:file:/E:/maven_dev/maven_3/apache-maven-3.5.2/repo/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/E:/maven_dev/maven_3/apache-maven-3.5.2/repo/org/slf4j/slf4j-log4j12/1.7.29/slf4j-log4j12-1.7.29.jar!/org/slf4j/impl/StaticLoggerBinder.class] Caused by: java.lang.IllegalArgumentException: LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either remove Logback or the competing implementation (class org.slf4j.impl.Log4jLoggerFactory loaded from file:/E:/maven_dev/maven_3/apache-maven-3.5.2/repo/org/slf4j/slf4j-log4j12/1.7.29/slf4j-log4j12-1.7.29.jar). If you are using WebLogic you will need to add 'org.slf4j' to prefer-application-packages in WEB-INF/weblogic.xml: org.slf4j.impl.Log4jLoggerFactory
SLF4J: Found binding in [jar:file:/E:/maven_dev/maven_3/apache-maven-3.5.2/repo/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/E:/maven_dev/maven_3/apache-maven-3.5.2/repo/org/slf4j/slf4j-log4j12/1.7.29/slf4j-log4j12-1.7.29.jar!/org/slf4j/impl/StaticLoggerBinder.class]
在pom.xml中添加
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.3</version>
</dependency><dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<!--解決日志包沖突-->
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>根據(jù)自己的版本進(jìn)行調(diào)整
<!--添加zookeeper版本,與虛擬機(jī)一致-->
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
<version>3.4.9</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>啟動ok!!!
總結(jié)
以上為個人經(jīng)驗(yàn),希望能給大家一個參考,也希望大家多多支持腳本之家。
相關(guān)文章
Java 實(shí)戰(zhàn)項(xiàng)目之精品養(yǎng)老院管理系統(tǒng)的實(shí)現(xiàn)流程
讀萬卷書不如行萬里路,只學(xué)書上的理論是遠(yuǎn)遠(yuǎn)不夠的,只有在實(shí)戰(zhàn)中才能獲得能力的提升,本篇文章手把手帶你用java+Springboot+Maven+mybatis+Vue+Mysql實(shí)現(xiàn)一個精品養(yǎng)老院管理系統(tǒng),大家可以在過程中查缺補(bǔ)漏,提升水平2021-11-11
java實(shí)現(xiàn)學(xué)生成績錄入系統(tǒng)
這篇文章主要為大家詳細(xì)介紹了java實(shí)現(xiàn)學(xué)生成績錄入系統(tǒng),具有一定的參考價值,感興趣的小伙伴們可以參考一下2018-01-01
如何基于FTP4J實(shí)現(xiàn)FTPS連接過程解析
這篇文章主要介紹了如何基于FTP4J實(shí)現(xiàn)FTPS連接過程解析,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下2020-10-10
淺談Java繼承中的轉(zhuǎn)型及其內(nèi)存分配
這篇文章主要介紹了淺談Java繼承中的轉(zhuǎn)型及其內(nèi)存分配,首先分享了簡單的代碼及運(yùn)行結(jié)果,然后對其進(jìn)行分析,繼而引出了2017-11-11
Java數(shù)據(jù)結(jié)構(gòu)之順序表的實(shí)現(xiàn)
線性表(linear?list)是n個具有相同特性的數(shù)據(jù)元素的有限序列。?線性表是一種在實(shí)際中廣泛使用的數(shù)據(jù)結(jié)構(gòu),本文將用Java實(shí)現(xiàn)順序表,感興趣的可以了解一下2022-09-09
SpringBoot中的多RabbitMQ數(shù)據(jù)源配置實(shí)現(xiàn)
本篇博客將介紹如何在 Spring Boot 中配置和管理多個 RabbitMQ 數(shù)據(jù)源,以滿足不同的應(yīng)用需求,具有一定的參考價值,感興趣的可以了解一下2023-09-09

