在Spring Boot中引入ZooKeeper的jar包,启动时报错,如图:
是slf4j日志包冲出导致,因为项目在spring-boot-starter-logging中已引入。
解决办法,排除ZooKeeper中slf4j的依赖:
<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
发表回复