在使用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).……(后面的大家应该都相同就省略辣)
再看了下依赖:
果然是有很多不同的日志哇,这得排除多余的只留一个!!!
排除步骤:
- 在pom.xml中找到日志所在的依赖文件(可以在Dependencies中找)
- 在pom的dependency中加入 exclusions
<exclusions>
<exclusion>
<groupId></groupId>
<artifactId></artifactId>
</exclusion>
<exclusions>
然后对应Dependendies中的内容进行一一排除,我的有三个,所以要exclusioin俩,留一个:
在pom.xml加入中红色框内的内容:
再次启动项目:
启动成功辣,木有报错,姐妹们赶快试试!!!!!