eureka 服务注册不到中心总是拒绝链接

2017-10-17 18:06:05.761  INFO 26560 --- [freshExecutor-0] com.netflix.discovery.DiscoveryClient    : Disable delta property : false
2017-10-17 18:06:05.761 INFO 26560 --- [freshExecutor-0] com.netflix.discovery.DiscoveryClient : Single vip registry refresh property : null
2017-10-17 18:06:05.761 INFO 26560 --- [freshExecutor-0] com.netflix.discovery.DiscoveryClient : Force full registry fetch : false
2017-10-17 18:06:05.761 INFO 26560 --- [freshExecutor-0] com.netflix.discovery.DiscoveryClient : Application is null : false
2017-10-17 18:06:05.761 INFO 26560 --- [freshExecutor-0] com.netflix.discovery.DiscoveryClient : Registered Applications size is zero : true
2017-10-17 18:06:05.761 INFO 26560 --- [freshExecutor-0] com.netflix.discovery.DiscoveryClient : Application version is -1: true
2017-10-17 18:06:05.761 INFO 26560 --- [freshExecutor-0] com.netflix.discovery.DiscoveryClient : Getting all instance registry info from the eureka server
2017-10-17 18:06:07.752 ERROR 26560 --- [tbeatExecutor-0] c.n.d.s.t.d.RedirectingEurekaHttpClient : Request execution error

com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused: connect
at com.sun.jersey.client.apache4.ApacheHttpClient4Handler.handle(ApacheHttpClient4Handler.java:187) ~[jersey-apache-client4-1.19.1.jar:1.19.1]
at com.sun.jersey.api.client.filter.GZIPContentEncodingFilter.handle(GZIPContentEncodingFilter.java:123) ~[jersey-client-1.19.1.jar:1.19.1]
at com.netflix.discovery.EurekaIdentityHeaderFilter.handle(EurekaIdentityHeaderFilter.java:27) ~[eureka-client-1.6.2.jar:1.6.2]
at com.sun.jersey.api.client.Client.handle(Client.java:652) ~[jersey-client-1.19.1.jar:1.19.1]
配置类:
package com.lhl.eurekaprovider;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;

@SpringBootApplication
@EnableDiscoveryClient
public class ProviderApplication {

public static void main(String[] args) {
SpringApplication.run(ProviderApplication.class, args);
}
}
controle 类
package com.lhl.eurekaprovider.web;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {

private final Logger logger = LoggerFactory.getLogger(getClass());

@Autowired
private DiscoveryClient discoveryClient;

@RequestMapping("/hello")
public String index(){
ServiceInstance instance = discoveryClient.getLocalServiceInstance();
logger.info("Host: " +instance.getHost()+" ; Service_Id: "+instance.getServiceId());
return "Hello World";
}
}
已邀请:

Raskolnikow

赞同来自:

ok 了,注册中心和服务提供方重启,又好了 

要回复问题请先登录注册