W3Schools Learner's Blog

W3Schools Programming knowledge summary website

div

7/06/2019

Eureka错误:Cannot execute request on any known server解决

Spring Cloud Eureka是一个服务治理框架,小编在启动Eureka服务器端的时候出现了Cannot execute request on any known server错误,具体内容如下所示:
Eureka client exception com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server
解决方案:
如果你的Spring Cloud Eureka项目的配置文件是application.properties格式,则添加如下配置:
server.port=8761
eureka.client.registerWithEureka=false  //true表示自己注册自己
eureka.client.fetchRegistry=false       //添加这行就不会报红色错误了
如果你的配置是application.yml格式,则这样添加配置:
server:
  port: 8761 #指定服务端口
eureka:
  client:
    registerWithEureka: false
    fetchRegistry: false
最后在Spring Cloud Eureka服务器端的main启动类上方加入@EnableEurekaServer注解,如图所示:

No comments:

Post a Comment

Note: only a member of this blog may post a comment.