zookeeper使用过程的错误
一、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使用过程的错误的更多相关文章
- redis cluster + sentinel详细过程和错误处理三主三备三哨兵
redis cluster + sentinel详细过程和错误处理三主三备三哨兵1.基本架构192.168.70.215 7001 Master + sentinel 27001192.168.70. ...
- Zookeeper 选举过程
Zookeeper 选举过程 问题 选举过程 服务器之间是怎么通信的? 答:QuorumCnxManager使用TCP-socket实现选举过程中的连接通信 Leader的选举过程在什么时候实现? L ...
- Zookeeper分布式过程协同技术 - 概念及基础
Zookeeper分布式过程协同技术 - 概念及基础 Zookeeper是什么? Zookeeper是一种分布式过程协同技术,其所提供的客户端API功能强大,其中包括: 保障强一致性.有序性和持久性. ...
- Zookeeper分布式过程协同技术 - 部署及设置
Zookeeper分布式过程协同技术 - 部署及设置 Zookeeper支持单机模式.伪集群模式.集群模式三种部署方式.演示部署环境为CentOS.jdk版本为1.8.Zookeeper版本为3.4 ...
- Zookeeper分布式过程协同技术 - 群首选举
Zookeeper分布式过程协同技术 - 群首选举 群首概念 群首为集群中服务器选择出来的一个服务器,并被集群认可.设置群首目的在与对客户端所发起的状态变更请求进行排序,包括:create.setDa ...
- ZooKeeper分布式过程协同技术详解1——ZooKeeper的概念和基础
简介 分布式系统和应用,不仅能提供更强的计算能力,还能为我们提供更好的容灾性和扩展性. ZooKeeper是Google的Chubby项目的开源实现,它曾经作为Hadoop的子项目,在大数据领域得到广 ...
- Zookeeper启动过程
在上一篇,我们了解了zookeeper最基本的配置,也从中了解一些配置的作用,那么这篇文章中,我们将介绍Zookeeper的启动过程,我们在了解启动过程的时候还要回过头看看上一篇中各个配置参数在启动时 ...
- 记一次zookeeper集群搭建错误的排除
zookeeper官网上的文档说得很清楚. http://zookeeper.apache.org/doc/r3.5.1-alpha/zookeeperAdmin.html#sc_designing ...
- mysql-5.5.28源码安装过程中错误总结
介绍一下关于mysql-5.5.28源码安装过程中几大错误总结,希望此文章对各位同学有所帮助.系统centOS 6.3 mini (没有任何编译环境)预编译环境首先装了众所周知的 cmake(yum ...
随机推荐
- 神经网络(9)--如何求参数: backpropagation algorithm(反向传播算法)
Backpropagation algorithm(反向传播算法) Θij(l) is a real number. Forward propagation 上图是给出一个training examp ...
- 学习Spring-Data-Jpa(五)---可嵌入对象和元素集合的使用
1.场景一:地址信息(省.市.县.详细地址)在很多实体中都需要,比如说作者有地址,订单也有地址,但是他们的地址并不能独立与他们存在,所以地址不能映射为实体,那么我们就需要在作者实体和订单实体中都添加这 ...
- 学习Spring-Data-Jpa(二)---JPA基本注解
基本注解 1.@Entity :用于添加在实体类上,定义该JAVA类成为被JPA管理的实体,将映射到指定的数据库表.如定义一个实体类Category,它将映射到数据库中的category表中. 2.@ ...
- debug错误总结
1, 2,就是一个大括号的问题..让你总是得不了满分..明明和别人的代码差不多. 3,就比如P1914,这种藏坑的题,或者说这一类藏坑的题. 坑是什么呢?就是位数不够往后推的时候.. 你不填坑你就得不 ...
- Django 第一天 开端
今日内容: 一.HTTP协议 1.HTTP协议简介 参考博客:https://www.cnblogs.com/clschao/articles/9230431.html 是超文本传输协议 现在使用最广 ...
- PHP安装之configure的配置参数
1.生成环境安装配置如下 要求安装如下库: imagickgdmysqlmysqlimysqlndphalconPharsoapsocketsxwebxsvczipzlib 具体查看 vim php- ...
- C语言malloc的用法及详解
#include <stdio.h> #include <stdlib.h> void freem(int* p){ #include <stdio.h> #inc ...
- AtCoder Grand Contest 010题解
传送门 \(A\) 判一下奇数的个数就行了 const int N=1e5+5; int a[N],n,res; int main(){ scanf("%d",&n); f ...
- 行列式的组合定义及其应用--反对称阵的Pfaffian
以组合定义为出发点的行列式理论的引入方式在很多高等代数或线性代数的教材中被采用, 其优缺点同样明显. 组合定义形式上的简单是其最大的优点, 用它可以简洁地证明行列式的所有性质, 并快速进入行列式的计算 ...
- 重写Dijkstra
啊我沙雕了,竟然以为DJ的邻接矩阵不用初始化.. #include<bits/stdc++.h> #define R register int using namespace std; / ...