一、zookeeper启动成功,dubbo服务也注册成功,但是服务消费者调用失败

报错如下:

[myid:] - INFO [SyncThread:0:ZooKeeperServer@645] - Est
ablished session 0x16ae75366b60004 with negotiated timeout 40000 for client /127
.0.0.1:5094
2019-05-24 09:43:52,695 [myid:] - INFO [ProcessThread(sid:0 cport:2181)::PrepRe
questProcessor@651] - Got user-level KeeperException when processing sessionid:0
x16ae75366b60004 type:create cxid:0x4 zxid:0x3c09 txntype:-1 reqpath:n/a Error P
ath:/dubbo/sellergoods.service.BrandService/configurators Error:KeeperErrorCode
= NodeExists for /dubbo/sellergoods.service.BrandService/configurators

1、网上找了很多解决的方法:删除zookeeper配置的data和logs中的version2的数据。但是还是不行。

后来发现这个根本不是zookeeper的错误,而是代码的问题。着重检查两个地方。

一、pom.xml中jar包的问题,注意dubbo(阿里巴巴官方)和dubbox(当当网,一般叫做dubbo2.8.4)需要的依赖是不一样的。

下面是当当网的dubbox的引用。

 <!-- dubbo相关 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>dubbo</artifactId>
<version>2.8.</version>
</dependency>
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
<version>3.4.</version>
</dependency>
<dependency>
<groupId>com.github.sgroschupf</groupId>
<artifactId>zkclient</artifactId>
<version>0.1</version>
</dependency>

二、检查dubbo扫描的xml文件,写法是否有误。官方有参照。

provider

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo" xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <dubbo:protocol name="dubbo" port="20880"></dubbo:protocol>
<!--<dubbo:protocol name="http" port="20881"></dubbo:protocol>--> <dubbo:application name="smallshop_goods_service" />
<dubbo:registry address="zookeeper://127.0.0.1:2181"/>
<!--扫描包名-->
<dubbo:annotation package="sellergoods.service.impl" /> </beans>

consumer

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo" xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<context:property-placeholder location="classpath:config/application.properties" /> <mvc:annotation-driven>
<mvc:message-converters register-defaults="true">
<bean class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter">
<property name="supportedMediaTypes" value="application/json"/>
<property name="features">
<array>
<value>WriteMapNullValue</value>
<value>WriteDateUseDateFormat</value>
</array>
</property>
</bean>
</mvc:message-converters>
</mvc:annotation-driven> <!-- 引用dubbo 服务 -->
<dubbo:application name="smallshop_manager_web" />
<dubbo:registry address="zookeeper://127.0.0.1:2181" timeout="6000"/>
<!--扫描包名-->
<dubbo:annotation package="smallshop.manager.controller" /> </beans>

zookeeper使用过程的错误的更多相关文章

  1. redis cluster + sentinel详细过程和错误处理三主三备三哨兵

    redis cluster + sentinel详细过程和错误处理三主三备三哨兵1.基本架构192.168.70.215 7001 Master + sentinel 27001192.168.70. ...

  2. Zookeeper 选举过程

    Zookeeper 选举过程 问题 选举过程 服务器之间是怎么通信的? 答:QuorumCnxManager使用TCP-socket实现选举过程中的连接通信 Leader的选举过程在什么时候实现? L ...

  3. Zookeeper分布式过程协同技术 - 概念及基础

    Zookeeper分布式过程协同技术 - 概念及基础 Zookeeper是什么? Zookeeper是一种分布式过程协同技术,其所提供的客户端API功能强大,其中包括: 保障强一致性.有序性和持久性. ...

  4. Zookeeper分布式过程协同技术 - 部署及设置

    Zookeeper分布式过程协同技术 -  部署及设置 Zookeeper支持单机模式.伪集群模式.集群模式三种部署方式.演示部署环境为CentOS.jdk版本为1.8.Zookeeper版本为3.4 ...

  5. Zookeeper分布式过程协同技术 - 群首选举

    Zookeeper分布式过程协同技术 - 群首选举 群首概念 群首为集群中服务器选择出来的一个服务器,并被集群认可.设置群首目的在与对客户端所发起的状态变更请求进行排序,包括:create.setDa ...

  6. ZooKeeper分布式过程协同技术详解1——ZooKeeper的概念和基础

    简介 分布式系统和应用,不仅能提供更强的计算能力,还能为我们提供更好的容灾性和扩展性. ZooKeeper是Google的Chubby项目的开源实现,它曾经作为Hadoop的子项目,在大数据领域得到广 ...

  7. Zookeeper启动过程

    在上一篇,我们了解了zookeeper最基本的配置,也从中了解一些配置的作用,那么这篇文章中,我们将介绍Zookeeper的启动过程,我们在了解启动过程的时候还要回过头看看上一篇中各个配置参数在启动时 ...

  8. 记一次zookeeper集群搭建错误的排除

    zookeeper官网上的文档说得很清楚. http://zookeeper.apache.org/doc/r3.5.1-alpha/zookeeperAdmin.html#sc_designing ...

  9. mysql-5.5.28源码安装过程中错误总结

    介绍一下关于mysql-5.5.28源码安装过程中几大错误总结,希望此文章对各位同学有所帮助.系统centOS 6.3 mini (没有任何编译环境)预编译环境首先装了众所周知的 cmake(yum ...

随机推荐

  1. 《CoderXiaoban》第八次团队作业:Alpha冲刺4

    项目 内容 这个作业属于哪个课程 任课教师博客主页链接 这个作业的要求在哪里 实验十二 团队作业8:软件测试与ALPHA冲刺 团队名称 Coderxiaoban团队 作业学习目标 (1)掌握软件测试基 ...

  2. 微信支付(APP支付)-服务端开发(二 )

    如果你已经可以微信支付成功,那么你已经成功90%,剩下的就是订单确认问题了. 接上一篇文章,今天我们来谈一谈,订单查询与确认: APP端支付成功之后,会再次向服务端发起请求,确认付款订单时候成功,同时 ...

  3. 学习Spring-Data-Jpa(五)---可嵌入对象和元素集合的使用

    1.场景一:地址信息(省.市.县.详细地址)在很多实体中都需要,比如说作者有地址,订单也有地址,但是他们的地址并不能独立与他们存在,所以地址不能映射为实体,那么我们就需要在作者实体和订单实体中都添加这 ...

  4. YAML_10 把监听端口是8080的Apache服务全部停止

    ansible]# vim ad.yml --- - hosts: cache   remote_user: root   tasks:     - shell: netstat -atunlp  | ...

  5. .net之大文件断点续传

    HTML部分 <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="index.a ...

  6. override关键字

    https://www.cnblogs.com/xinxue/p/5471708.html 2  重写 (override) 在 1.2.2 中提到 override 关键字,可以避免派生类中忘记重写 ...

  7. web表单

    1.配置 使用Flask-WTF, 它集成了WTForms并且完美地集成到了flask. 在microblog根目录下创建一个文件,存储flask扩展的所有配置,CSRF_ENABLED用于激活跨站点 ...

  8. Ancient Go(简单DFS)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5546 AC代码: #include<iostream> #include<cstdi ...

  9. C++ 如何进阶?

    1.C++的用途和意义 总体来说,C++作为一门软件开发语言,它的流行度是在减少的.主要原因在于语言的复杂和灵活导致软件开发成本提高,这体现在开发周期和人力上.它不适用于startup公司的快速开发, ...

  10. 7中漂亮的纯css字体

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...