解决dubbo3.0项目中zookeeper连接失败的问题

问题描述:Springboot整合dubbo3.0.1

<dependency>
    <groupId>org.apache.dubbo</groupId>
    <artifactId>dubbo-spring-boot-starter</artifactId>
    <version>3.0.1</version>
</dependency>
<!--zookeeper 注册中心客户端引入 使用的是curator客户端 -->
<dependency>
    <!-- https://mvnrepository.com/artifact/org.apache.dubbo/dubbo-dependencies-zookeeper -->
    <groupId>org.apache.dubbo</groupId>
    <artifactId>dubbo-dependencies-zookeeper</artifactId>
    <version>3.0.1</version>
    <type>pom</type>
    <exclusions>
        <exclusion>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
        </exclusion>
    </exclusions>
</dependency>
dubbo.application.name=demo-provider
dubbo.registry.address=zookeeper://localhost:2181
dubbo.protocol.name=dubbo
dubbo.protocol.port=20880
dubbo.scan.base-packages=cn.test

看起来毫无问题,启动项目
在这里插入图片描述
在这里插入图片描述
解决方式:自带的zookeeper版本不行,需要自己添加zookeeper版本

 <dependency>
     <groupId>org.apache.zookeeper</groupId>
     <artifactId>zookeeper</artifactId>
     <version>3.7.0</version>
     <!--排除这个slf4j-log4j12-->
     <exclusions>
         <exclusion>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-log4j12</artifactId>
         </exclusion>
     </exclusions>
 </dependency>

问题解决!

你可能感兴趣的:(问题,dubbo,zookeeper,java)