com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused: connect 异常
1.异常描述;
springCloud项目本地启动报错
2.出现异常是:
com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused: connect
或者com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server
3.原因:
在默认情况下,Eureka服务注册中心也会将自己作为客户端来尝试注册它自己,所以我们需要禁用它的客户端注册行为.
4.解决办法;
application.properties的配置文件中添加如下内容
eureka.client.register-with-eureka=false
eureka.client.fetch-registry=false