zoukankan      html  css  js  c++  java
  • Thrown "KeeperErrorCode = Unimplemented for /services" exception

    1.环境

    spring-boot 2.1.3 依赖项:spring-cloud-starter-zookeeper-discovery 版本2.1.1

    使用的zookeeper3.4.11

    代码如下:

    package com.example.demo;
    
    import java.net.InetAddress;
    import java.net.UnknownHostException;
    
    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
    import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
    import org.springframework.context.annotation.Configuration;
    import org.springframework.web.bind.annotation.RequestMapping;
    import org.springframework.web.bind.annotation.ResponseBody;
    import org.springframework.web.bind.annotation.RestController;
    
    @Configuration
    @EnableAutoConfiguration
    @EnableDiscoveryClient
    @RestController
    public class ZkDiscoveryApplication {
        
        @RequestMapping("/")
        @ResponseBody
        String home() {
            String message = "Hello World from Greeting Microservice located at %s!";
            try {
                String address = InetAddress.getLocalHost().getHostAddress();
                message = String.format(message, address);
            } catch (UnknownHostException e) {
                message = String.format(message, "Unknown Host");
            }
    
            return message;
    
        }

    2.启动spring boot项目报错

    Thrown "KeeperErrorCode = Unimplemented for /services" exception

    3.原因

    Curator 和zookeeper的版本不一致

    4.解决方式

    zookeeper升级到最新的5.x后异常消失

  • 相关阅读:
    【Python】小技巧
    【Python】内置函数清单
    【Python】序列的方法
    【Python】异常处理
    【Python】函数的参数对应
    【Python】函数对象
    redhat7安装jdk1.7报错/home/renqiwei/jdk1.7/bin/java: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
    redhat更换yum源
    python3降级为python2(linux)
    centos安装apt命令
  • 原文地址:https://www.cnblogs.com/davidwang456/p/10514637.html
Copyright © 2011-2022 走看看