一、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. markdown种嵌入html标签,实现自定义样式

    转:https://www.cnblogs.com/buwuliao/p/9578918.html -------------------------------------------------- ...

  2. elementUI 控制 DatePicker组件 不能选择 设定的日期

    <el-date-picker v-model="date" type="daterange" range-separator="至" ...

  3. to_excel

    Signature: df.to_excel( ['excel_writer', "sheet_name='Sheet1'", "na_rep=''", 'fl ...

  4. fastjson ping外带信息poc

    public class Exploit { public Exploit(){ String base_url = ".egpkd5.dnslog.cn"; //你的dnslog ...

  5. windows下面同时部署多个tomcat的方法

    下面我们把配置的详细过程写在下面,以供参考:(此例以配置三个Tomcat为例)1. 下载apache-tomcat-7.0.63,下载下来的文件为apache-tomcat-7.0.63.zip.2. ...

  6. LightOJ - 1245 - Harmonic Number (II)(数学)

    链接: https://vjudge.net/problem/LightOJ-1245 题意: I was trying to solve problem '1234 - Harmonic Numbe ...

  7. python中的一切皆对象

    python中一切皆对象是这个语言灵活的根本.函数和类也是对象,属于python的一等公民.包括代码包和模块也都是对象.python的面向对象更加彻底. 可以赋值给一个变量可以添加到集合对象中可以作为 ...

  8. 四大网络之Alexnet

       本文主要介绍AlextNet的一些知识,这些知识经常被忽略 一.AlextNet的创新点 (1)成功使用ReLU作为CNN的激活函数,并验证其效果在较深的网络超过了Sigmoid,成功解决了Si ...

  9. C# 遍历 enum 枚举

    foreach (Suit suit in (Suit[]) Enum.GetValues(typeof(Suit))) { } 注意:强制转换(Suit[])不是必需的,但确实使代码快0.5 ns.

  10. Kubernetes 学习8 Pod控制器

    一.回顾 1.Pod是标准的kubernetes资源,因此其遵循为其资源清单配置定义的基本格式,包含:apiVersion,kind,metadata,spec,status(只读) 2.spec的内 ...