Visa Developer Community

Highlighted
Regular Visitor

Getting Connection refused when using Java sample application

Hi,

I am trying to setup a Java application for Foreign Exchange Rate.

I am able to create a good jks file and able to successfully test it from SoapUI.

But when trying to execute the test Java application, I am getting error in Maven and in Eclipse:

 

org.apache.http.conn.HttpHostConnectException: Connect to sandbox.api.visa.com:443 [sandbox.api.visa.com/104.93.188.21] failed: Connection refused: connect

at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:158)

at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)

at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)

at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)

at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)

at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)

at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)

at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)

at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)

at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:107)

at com.visa.vdp.utils.VisaAPIClient.doMutualAuthRequest(VisaAPIClient.java:123)

at com.visa.vdp.foreignexchange.TestForeignExchangeRates.main(TestForeignExchangeRates.java:51)

Caused by: java.net.ConnectException: Connection refused: connect

at java.net.DualStackPlainSocketImpl.connect0(Native Method)

at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)

at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)

at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)

at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)

at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)

at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)

at java.net.Socket.connect(Socket.java:579)

at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:337)

at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:141)

... 11 more

Please let me know what I am doing wrong.

I am attaching the jks file: myapp_keyAndCertBundle.jks

Thank you.

2 REPLIES 2
Highlighted
Regular Visitor

Re: Getting Connection refused when using Java sample application

Hi,

Any updates for me ? I tried all sample code and I am always getting same error: Connection refused.

Can you let me know what is wrong with my Java request ?

Thanks.

Tags (2)
Highlighted
Regular Visitor

Re: Getting Connection refused when using Java sample application

Can some one please reply on this , as i am also getting the same issue when trying to connect https://sandbox.api.visa.com/