spring-cloud-netflix: Connection refused while trying to register eureka-clients

I have one eureka-server running on a linux(testsrv1) machine. I’m able to register services when they run on the same linux machine. Now I want to register a service running on my localhost. But I’m bot able to register this service. I get this exception:

2016-08-31 09:17:31.917 ERROR 27105 --- [freshExecutor-0] c.n.d.s.t.d.RedirectingEurekaHttpClient  : Request execution error
com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused
Caused by: java.net.ConnectException: Connection refused
2016-08-31 09:17:31.917  WARN 27105 --- [freshExecutor-0] c.n.d.s.t.d.RetryableEurekaHttpClient    : Request execution failure
2016-08-31 09:17:31.918 ERROR 27105 --- [freshExecutor-0] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_RESERVATION-SERVICE/testsrv1.myDomain.lan:reservation-service:8002 - was unable to refresh its cache! status = Cannot execute request on any known server
com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server
2016-08-31 09:17:31.924 ERROR 27105 --- [tbeatExecutor-0] c.n.d.s.t.d.RedirectingEurekaHttpClient  : Request execution error

My Eureka-Server has this properties:

spring.application.name=eureka-service
spring.cloud.config.uri=http://myLocalMachine.myDomain.lan:8888
server.port=8761
eureka.client.register-with-eureka=false
eureka.client.fetch-registry=false

My Client-service has this properties:

spring:
  application:
    name: reservation-service
  cloud:
    config:
      uri: http://myLocalMachine.myDomain.lan:8888
server:
  port: 8002
eureka:
  client:
    service-url:
     defaultzone: http://testsrv1:8761/eureka/

The Eureka-Server is abel to reach the cloud-config-files from my config-service running on localhost.

Is there any configuration missing or do I need the cloud foundry?

Thanks in advance!

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 21 (7 by maintainers)

Most upvoted comments

After days, looking thousand times on the same config file I realized the issue. At the end it was just a misspelling of defaultzone. After changing it to defaultZone everything works like expected. Thank you very much for your time.

There wouldn’t happen to be any configuration from the config server that is overriding the defaultzone property, is there?

@rahula072 for eureka server, make your application.properties as shown below:

server.port=9002 spring.application.name=eureka-service #Eureka server eureka.client.register-with-eureka=false eureka.client.fetch-registry=false

logging.level.com.netflix.eureka=OFF logging.level.com.netflix.discovery=OFF

@ranesaci

Thanks you so much for your help. Now Eureka server is up and running ,thanks to u.

Guys, I was also facing same issue. I solved this issue with below process.

Error: com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server Request execution failed with message: java.net.ConnectException: Connection refused: connect

Solution:

http://sachin4java.blogspot.in/2017/12/cndstdredirectingeurekahttpclient.html

Hope, this will save your time.