在Spring Boot中引入ZooKeeper的jar包,启动时报错,如图:
![](https://www.wangzhengzhen.com/wp-content/uploads/2019/03/2019-03-03-23-05-04-的屏幕截图-1024x330.png)
是slf4j日志包冲出导致,因为项目在spring-boot-starter-logging中已引入。
解决办法,排除ZooKeeper中slf4j的依赖:
![](https://www.wangzhengzhen.com/wp-content/uploads/2019/03/2019-03-03-23-09-01-的屏幕截图.png)
<dependency> <groupId>org.apache.zookeeper</groupId> <artifactId>zookeeper</artifactId> <version>${zookeeper.version}</version> <exclusions> <exclusion> <artifactId>slf4j-log4j12</artifactId> <groupId>org.slf4j</groupId> </exclusion> </exclusions> </dependency>
参考:https://blog.csdn.net/change987654321/article/details/82800279
发表回复