I have a Spring Cloud application (Eureka, Ribbon, Zuul) that runs perfectly locally in Spring Tools Suite. When I deploy to Pivotal Web Services, the services register with Eureka (i.e., they show up in the Eureka console), but when I try to have one service call another I get Connection refused. When I try to go through Zuul, I get Forwarding Error followed by Connection refused.
I've tried various combinations of the following, but nothing seems to help.
eureka:
client:
serviceUrl:
defaultZone: http://myeurekaserver.cfapps.io/eureka/
instance:
preferIpAddress: true
# hostname: ${CF_INSTANCE_IP:localhost}
# nonSecurePort: ${CF_INSTANCE_PORT:${PORT:${server.port:8002}}}
hostname: ${vcap.application.uris[0]}
nonSecurePort: 80
For the service to service calls I use the Autowired RestTemplate. In another part of my code I use the non-Autowired RestTemplate. When I use that with discoveryClient.getInstances(...) I do get back the ip address and ports of my services. If I try to directly call those IP addresses/ports I also get Connection Refused.
Any ideas?