Eureka - Can't get a response - Can't contact any eureka nodes

user3270760 picture user3270760 · Dec 19, 2014 · Viewed 13.2k times · Source

I have a Eureka server running on port 8761 (localhost:8761/eureka) and I have a Zuul application that I would like to register with eureka, but I keep getting the same error:

Can't get a response from http://localhost:8761/eurekaapps/ZUULSERVER
Can't contact any eureka nodes - possibly a security group issue?

java.lang.RuntimeException: Bad status: 404
        at com.netflix.discovery.DiscoveryClient.makeRemoteCall(DiscoveryClient.java:1155)
        at com.netflix.discovery.DiscoveryClient.makeRemoteCall(DiscoveryClient.java:1060)
        at com.netflix.discovery.DiscoveryClient.register(DiscoveryClient.java:606)
        at com.netflix.discovery.DiscoveryClient$HeartbeatThread.run(DiscoveryClient.java:1596)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)

Here is my application.yml for the zuul application:

info:
  component: Zuul Server

eureka:
  server:
    enabled: true
  client:
    serviceUrl:
      defaultZone: http://localhost:8761/eureka
    registerWithEureka: true
    fetchRegistry: false  

endpoints:
  restart:
    enabled: true
  shutdown:
    enabled: true
  health:
    sensitive: false

zuul:
  route:
    discovery:
      url: http://localhost:9000/polaris/discovery 
      path: /polaris/discovery/**
    sla:
      url: http://localhost:9000/polaris/sla
      path: /polaris/sla/**
    stores: /stores/**
    customers: /customers/**

#remove when spring-boot 1.2.1 is out
security:
  basic:
    enabled: false
management:
  security:
    enabled:
      false

server:
  port: 8765

logging:
  level:
    ROOT: INFO
    org.springframework.web: DEBUG

Did I just mess up one of these values and so zuul is unable to see the eureka server? It seems like it is not registering properly. Maybe I missed a crucial parameter in the application.yml file?

Answer

Dave Syer picture Dave Syer · Dec 19, 2014

The clue is "eurekaapps" in the error. You need a trailing "/" in the service URL:

eureka:
  client:
    serviceUrl:
      defaultZone: http://localhost:8761/eureka/

(which is the default anyway I think).