Getting java.net.ConnectException : Connection refused
I looked for solutions on SO for this but none of them seem to apply to my
case. So here goes: I have an application that needs to make a service
call to a third party domain. I am using jersey client to make this
service call. The code for making this call is
ClientResponse resp = resourceWithParams.
header("Authorization", getAccessKeyId() + ":" +
hmacSha1.toUpperCase()).
post(ClientResponse.class,"");
where resourceWithParams is the jersey web resource. Note that even though
its is a POST, the web service is expecting a query string and empty body.
It might be questionable design but that is what we have to work with.
This setup is working just fine on my local machine as well as on our
preprod server. However on our production servers it gives an exception:
com.sun.jersey.api.client.ClientHandlerException:
java.net.ConnectException: Connection refused
There are a couple of points below that might be helpful in pointing me in
the right direction:
1) We get a valid response when we use curl on the prod server command
line to send a request to the web service so seems like there are no
firewall issues. This is happening only when we try it through the web
application, i.e. through the java code using jersey client.
2) There are no proxies set up on the prod servers
3) Works fine from localhost.
4) The Rest webservice uses https and the correct certificates are
installed on our server which is proved by the fact that curling the
webservice on prod works fine.
Any ideas on what the issue might be and where we should start looking?
No comments:
Post a Comment