I'm calling a service using RestTemplate
in Spring Framework from a service deployed on PCF but, I am getting:
java.net.ConnectException: Connection refused Exception.
I have cross verified all my configurations and read articles and come to conclusion that, its an firewall problem. Can someone help to to make changes into firewall so as to solve it
An application deployed to Cloud Foundry will not be able to open any connections out of the container that it is running in unless the application security group in the space the app is running in allow this.
In the application manager for PCF you can click on the settings tab of the space and it should show you all the application security groups for the space. If you don't see it allowing access to the target system you are calling then you will need to configure the space ASG to allow access.
You can also try cf ssh <appname>
to ssh into the container running your app then you can do a ping from the container. It is possible that your pcf instance has cf ssh
disabled to increase security.