解决日志框架不唯一_Class path contains multiple SLF4J bindings

在使用Dubbo和Zookeeper的时候,导入zookeeper依赖,启动项目后报错:

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/D:/CommonProgramFile/apache-maven-3.5.4/repository/org/slf4j/slf4j-reload4j/1.7.36/slf4j-reload4j-1.7.36.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/D:/CommonProgramFile/apache-maven-3.5.4/repository/ch/qos/logback/logback-classic/1.2.11/logback-classic-1.2.11.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.slf4j.impl.Reload4jLoggerFactory]
Exception in thread "main" 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.Reload4jLoggerFactory loaded from file:/D:/CommonProgramFile/apache-maven-3.5.4/repository/org/slf4j/slf4j-reload4j/1.7.36/slf4j-reload4j-1.7.36.jar).……(后面的大家应该都相同就省略辣)

再看了下依赖:
依赖
果然是有很多不同的日志哇,这得排除多余的只留一个!!!
排除步骤:

  1. 在pom.xml中找到日志所在的依赖文件(可以在Dependencies中找)
    在这里插入图片描述
  2. 在pom的dependency中加入 exclusions
<exclusions>
                <exclusion>
                    <groupId></groupId>
                    <artifactId></artifactId>
                </exclusion>
<exclusions>

然后对应Dependendies中的内容进行一一排除,我的有三个,所以要exclusioin俩,留一个:
在这里插入图片描述
在pom.xml加入中红色框内的内容:
在这里插入图片描述
再次启动项目:
在这里插入图片描述
启动成功辣,木有报错,姐妹们赶快试试!!!!!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

StarKNG

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值