最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

解決SpringBoot項目中l(wèi)og4j與logback的Jar包沖突問題

 更新時間:2023年10月08日 10:12:11   作者:lzh_me  
這篇文章主要給大家介紹了解決SpringBoot項目中l(wèi)og4j與logback的Jar包沖突問題,文中有詳細的解決方法和沖突的原因,有遇到相同問題的朋友可以參考閱讀本文

異常信息關鍵詞:

SLF4J: Class path contains multiple SLF4J bindings.
ERROR in ch.qos.logback.core.joran.spi.Interpreter@24:14 - no applicable action for [properties], current ElementPath  is [[configuration][properties]]

詳細異常信息:

Connected to the target VM, address: '127.0.0.1:52687', transport: 'socket'
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/xx/.m2/repository/ch/qos/logback/logback-classic/1.2.11/logback-classic-1.2.11.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/xx/.m2/repository/org/apache/logging/log4j/log4j-slf4j-impl/2.17.2/log4j-slf4j-impl-2.17.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.util.ContextSelectorStaticBinder]
Logging system failed to initialize using configuration from 'classpath:log4j2.xml'
java.lang.IllegalStateException: Logback configuration error detected: 
ERROR in ch.qos.logback.core.joran.spi.Interpreter@24:14 - no applicable action for [properties], current ElementPath  is [[configuration][properties]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@26:29 - no applicable action for [property], current ElementPath  is [[configuration][properties][property]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@28:31 - no applicable action for [property], current ElementPath  is [[configuration][properties][property]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@29:33 - no applicable action for [property], current ElementPath  is [[configuration][properties][property]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@30:36 - no applicable action for [property], current ElementPath  is [[configuration][properties][property]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@32:13 - no applicable action for [appenders], current ElementPath  is [[configuration][appenders]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@34:47 - no applicable action for [Console], current ElementPath  is [[configuration][appenders][Console]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@37:71 - no applicable action for [ThresholdFilter], current ElementPath  is [[configuration][appenders][Console][ThresholdFilter]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@38:44 - no applicable action for [PatternLayout], current ElementPath  is [[configuration][appenders][Console][PatternLayout]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@47:79 - no applicable action for [RollingFile], current ElementPath  is [[configuration][appenders][RollingFile]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@48:44 - no applicable action for [PatternLayout], current ElementPath  is [[configuration][appenders][RollingFile][PatternLayout]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@49:14 - no applicable action for [Policies], current ElementPath  is [[configuration][appenders][RollingFile][Policies]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@53:46 - no applicable action for [SizeBasedTriggeringPolicy], current ElementPath  is [[configuration][appenders][RollingFile][Policies][SizeBasedTriggeringPolicy]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@56:39 - no applicable action for [DefaultRolloverStrategy], current ElementPath  is [[configuration][appenders][RollingFile][DefaultRolloverStrategy]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@59:11 - no applicable action for [loggers], current ElementPath  is [[configuration][loggers]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@61:80 - no applicable action for [Logger], current ElementPath  is [[configuration][loggers][Logger]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@62:33 - no applicable action for [appender-ref], current ElementPath  is [[configuration][loggers][Logger][appender-ref]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@64:109 - no applicable action for [Logger], current ElementPath  is [[configuration][loggers][Logger]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@65:33 - no applicable action for [appender-ref], current ElementPath  is [[configuration][loggers][Logger][appender-ref]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@67:81 - no applicable action for [Logger], current ElementPath  is [[configuration][loggers][Logger]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@68:33 - no applicable action for [appender-ref], current ElementPath  is [[configuration][loggers][Logger][appender-ref]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@71:79 - no applicable action for [Logger], current ElementPath  is [[configuration][loggers][Logger]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@72:33 - no applicable action for [appender-ref], current ElementPath  is [[configuration][loggers][Logger][appender-ref]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@74:71 - no applicable action for [Logger], current ElementPath  is [[configuration][loggers][Logger]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@75:33 - no applicable action for [appender-ref], current ElementPath  is [[configuration][loggers][Logger][appender-ref]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@77:87 - no applicable action for [Logger], current ElementPath  is [[configuration][loggers][Logger]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@78:33 - no applicable action for [appender-ref], current ElementPath  is [[configuration][loggers][Logger][appender-ref]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@80:88 - no applicable action for [Logger], current ElementPath  is [[configuration][loggers][Logger]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@81:33 - no applicable action for [appender-ref], current ElementPath  is [[configuration][loggers][Logger][appender-ref]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@83:80 - no applicable action for [Logger], current ElementPath  is [[configuration][loggers][Logger]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@84:77 - no applicable action for [Logger], current ElementPath  is [[configuration][loggers][Logger]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@85:33 - no applicable action for [appender-ref], current ElementPath  is [[configuration][loggers][Logger][appender-ref]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@87:84 - no applicable action for [Logger], current ElementPath  is [[configuration][loggers][Logger]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@88:77 - no applicable action for [Logger], current ElementPath  is [[configuration][loggers][Logger]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@89:33 - no applicable action for [appender-ref], current ElementPath  is [[configuration][loggers][Logger][appender-ref]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@92:55 - no applicable action for [Logger], current ElementPath  is [[configuration][loggers][Logger]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@93:57 - no applicable action for [Logger], current ElementPath  is [[configuration][loggers][Logger]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@94:65 - no applicable action for [Logger], current ElementPath  is [[configuration][loggers][Logger]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@95:56 - no applicable action for [Logger], current ElementPath  is [[configuration][loggers][Logger]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@96:64 - no applicable action for [Logger], current ElementPath  is [[configuration][loggers][Logger]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@97:68 - no applicable action for [Logger], current ElementPath  is [[configuration][loggers][Logger]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@98:64 - no applicable action for [Logger], current ElementPath  is [[configuration][loggers][Logger]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@99:76 - no applicable action for [Logger], current ElementPath  is [[configuration][loggers][Logger]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@100:72 - no applicable action for [Logger], current ElementPath  is [[configuration][loggers][Logger]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@101:67 - no applicable action for [Logger], current ElementPath  is [[configuration][loggers][Logger]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@102:52 - no applicable action for [Logger], current ElementPath  is [[configuration][loggers][Logger]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@103:65 - no applicable action for [Logger], current ElementPath  is [[configuration][loggers][Logger]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@104:66 - no applicable action for [Logger], current ElementPath  is [[configuration][loggers][Logger]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@105:66 - no applicable action for [Logger], current ElementPath  is [[configuration][loggers][Logger]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@106:62 - no applicable action for [Logger], current ElementPath  is [[configuration][loggers][Logger]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@107:79 - no applicable action for [Logger], current ElementPath  is [[configuration][loggers][Logger]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@110:61 - no applicable action for [Logger], current ElementPath  is [[configuration][loggers][Logger]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@111:33 - no applicable action for [appender-ref], current ElementPath  is [[configuration][loggers][Logger][appender-ref]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@112:29 - no applicable action for [appender-ref], current ElementPath  is [[configuration][loggers][Logger][appender-ref]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@116:23 - no applicable action for [root], current ElementPath  is [[configuration][loggers][root]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@117:33 - no applicable action for [appender-ref], current ElementPath  is [[configuration][loggers][root][appender-ref]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@119:29 - no applicable action for [appender-ref], current ElementPath  is [[configuration][loggers][root][appender-ref]]
	at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadConfiguration(LogbackLoggingSystem.java:179)
	at org.springframework.boot.logging.AbstractLoggingSystem.initializeWithSpecificConfig(AbstractLoggingSystem.java:66)
	at org.springframework.boot.logging.AbstractLoggingSystem.initialize(AbstractLoggingSystem.java:57)
	at org.springframework.boot.logging.logback.LogbackLoggingSystem.initialize(LogbackLoggingSystem.java:132)
	at org.springframework.boot.context.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:332)
	at org.springframework.boot.context.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:298)
	at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEnvironmentPreparedEvent(LoggingApplicationListener.java:246)
	at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:223)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131)
	at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:85)
	at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$2(SpringApplicationRunListeners.java:66)
	at java.util.ArrayList.forEach(ArrayList.java:1257)

異常信息告訴我們是jar包沖突導致,解決辦法很簡單,異常信息里面有個官網的地址,說明了解決方式,如下圖:

訪問地址:http://www.slf4j.org/codes.html#multiple_bindings

解決方式是指定使用的jar包,排除另一個不用的即可。

麻煩的是怎么找到導致jar沖突的依賴。

繼續(xù)查看異常信息,提示了沖突的2個jar包的信息,如下截圖:logback-classic和log4j-slf4j-impl。

查找jar依賴關系可以通過IDEA的maven插件,如下圖直接搜索:

找到了相應的依賴包。

也可以通過樹狀結構查看,不如直接搜索來的直觀:

或者通過maven命令查找:

dependency:tree -Dverbose -Dincludes=ch.qos.logback

找到導致沖突的依賴jar包,問題就好解決了,我這里是spring-boot-starter-test包導致的,直接排除springboot自帶的logback即可,clean后運行項目可以正常啟動了。

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-test</artifactId>
    <scope>test</scope>
    <!-- 排除自帶的logback依賴 -->
     <exclusions>
        <exclusion>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-logging</artifactId>
        </exclusion>
    </exclusions>
</dependency>

每個項目導致的原因可能各不相同,這是我遇到的一次jar包沖突供參考。

以上就是解決SpringBoot項目中l(wèi)og4j與logback的Jar包沖突問題的詳細內容,更多關于SpringBoot log4j與logback的資料請關注腳本之家其它相關文章!

相關文章

  • 關于springboot配置druid數(shù)據(jù)源不生效問題(踩坑記)

    關于springboot配置druid數(shù)據(jù)源不生效問題(踩坑記)

    今天日常跟著網課學習,學到了整合druid數(shù)據(jù)源,遇到了好幾個坑,希望這篇文章可以幫助一些和我一樣踩坑的人
    2021-09-09
  • Java?String源碼contains題解重復疊加字符串匹配

    Java?String源碼contains題解重復疊加字符串匹配

    這篇文章主要為大家介紹了Java?String源碼contains題解重復疊加字符串匹配示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪
    2022-11-11
  • 淺聊java8中數(shù)值流的使用

    淺聊java8中數(shù)值流的使用

    java8為我提供的簡單快捷的數(shù)值流計算API,本文就基于幾個常見的場景介紹一下數(shù)值流API的使用,文中的示例代碼講解詳細,感興趣的小伙伴可以了解下
    2023-10-10
  • 怎樣通過反射獲取非靜態(tài)內部類實例

    怎樣通過反射獲取非靜態(tài)內部類實例

    這篇文章主要介紹了怎樣通過反射獲取非靜態(tài)內部類實例,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2023-03-03
  • Spring注解配置AOP導致通知執(zhí)行順序紊亂解決方案

    Spring注解配置AOP導致通知執(zhí)行順序紊亂解決方案

    這篇文章主要介紹了Spring注解配置AOP導致通知執(zhí)行順序紊亂解決方案,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友可以參考下
    2020-10-10
  • SpringBoot中實現(xiàn)數(shù)據(jù)字典的示例代碼

    SpringBoot中實現(xiàn)數(shù)據(jù)字典的示例代碼

    這篇文章主要介紹了SpringBoot中實現(xiàn)數(shù)據(jù)字典的示例代碼,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2020-09-09
  • Spring Bean的六種作用域詳解

    Spring Bean的六種作用域詳解

    文章介紹了Spring框架中6種Bean作用域類型,包括singleton(單例,默認),prototype(原型)request(請求域)session(會話域)application(應用域)和websocket(WebSocket域),每種解釋了作用域的核心效果、適用場景和代碼示例,需要的朋友可以參考下
    2026-04-04
  • JFinal使用ajaxfileupload實現(xiàn)圖片上傳及預覽

    JFinal使用ajaxfileupload實現(xiàn)圖片上傳及預覽

    這篇文章主要為大家詳細介紹了JFinal使用ajaxfileupload實現(xiàn)圖片上傳及預覽,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2019-09-09
  • JAVA+Struts2獲取服務器地址的方法

    JAVA+Struts2獲取服務器地址的方法

    這篇文章主要介紹了JAVA+Struts2獲取服務器地址的方法,是Struts2的一個簡單應用,具有一定的借鑒與參考價值,需要的朋友可以參考下
    2014-11-11
  • java并發(fā)編程專題(三)----詳解線程的同步

    java并發(fā)編程專題(三)----詳解線程的同步

    這篇文章主要介紹了JAVA并發(fā)編程 線程同步的的相關資料,文中示例代碼非常詳細,幫助大家更好的理解和學習,感興趣的朋友可以了解下
    2020-06-06

最新評論

泰安市| 凉城县| 台东县| 清丰县| 丹东市| 怀化市| 甘孜县| 揭西县| 南皮县| 建德市| 绥中县| 双鸭山市| 奇台县| 平顶山市| 郓城县| 铜川市| 本溪| 锦州市| 深水埗区| 伊金霍洛旗| 德庆县| 泸西县| 仁布县| 集贤县| 福州市| 铁岭市| 青铜峡市| 金秀| 堆龙德庆县| 裕民县| 白山市| 沙坪坝区| 福贡县| 通化市| 和平区| 行唐县| 师宗县| 临沭县| 美姑县| 南和县| 林甸县|