解决LoggerFactory is not a Logback LoggerEither remove Logback or the competing implementation (class

一个项目引入了amqp以后报错,疑似包冲突,最后利用dependency analyzer终于解决了。

问题:
在这里插入图片描述

原依赖:

 <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-amqp</artifactId>
        </dependency>

下一步:寻找有logback包的位置
在这里插入图片描述
排掉所有logback包:

 <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-amqp</artifactId>
            <exclusions>
                <exclusion>
                    <artifactId>logback-classic</artifactId>
                    <groupId>ch.qos.logback</groupId>
                </exclusion>
                <exclusion>
                    <groupId>ch.qos.logback</groupId>
                    <artifactId>logback-core</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

再次启动:
在这里插入图片描述
成功解决。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
日志错误信息中的“LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either remove Logback or the competing implementation”表示日志工厂(LoggerFactory)不是LogbackLoggerContext,但是Logback在类路径上存在。这意味着存在与Logback冲突的其他日志实现。 解决这个问题有两种方法: 1. 移除Logback:您可以从项目的依赖中移除Logback,这样就不会与其他日志实现发生冲突了。 2. 排除冲突实现:如果您希望继续使用Logback,而且需要解决与其他实现的冲突,可以通过在项目的依赖配置中排除冲突实现来解决。例如,在Maven项目中,您可以使用<exclusions>标签来排除冲突的实现,如上文引用中所示。 如果您正在使用WebLogic服务器,还需要将'org.slf4j'添加到WEB-INF/weblogic.xml文件的prefer-application-packages中,以解决这个问题。 请根据您的实际需求选择适合的解决方案。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *3* [LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either remove Logback](https://blog.csdn.net/qq_37241221/article/details/126134281)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* [Error(13) 解决LoggerFactory is not a Logback LoggerContext but Logback is on the classpath](https://blog.csdn.net/qq_38225558/article/details/111823106)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值