java.net.ConnectException: Connection refused: connect

Document created by Nikita_nandakumar on Oct 14, 2014Last modified by dave_lesshafft on Mar 2, 2016
Version 2Show Document
  • View in full screen mode
The process using a HTTP client connector might  return an error similar to as shown below:

 

'Failed to execute SEND operation' caused by Connection refused: connect

 

A sample stack trace :

 

java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(Unknown Source)
at sun.net.NetworkClient.doConnect(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.protocol.https.HttpsClient.<init>(Unknown Source)
at sun.net.www.protocol.https.HttpsClient.New(Unknown Source)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown
Error Message 
Please check and verify the following :

 

1) Check the HTTP client connection.

 

If using the SSL authentication, check and verify  if the SSL cert is valid or not.

 

You could test the connection using Basic authentication.This will make sure if there is an issue with the SSL cert that is being used.

 

2) Check the endpoint URL.Check with the company network team to see if there is a firewall/proxy causing the problem.Check the endpoint server logs for any error.

Attachments

    Outcomes