Support Article
Connect-Rest failing with Connection to your_host refused
SA-24269
Summary
Getting below exception when trying to connect to Rest service. The REST service is hosted in Pega application.
Both the service and the connector are in the same application.
com.pega.apache.http.conn.HttpHostConnectException: Connection to your_hostURL refused
Error Messages
com.pega.apache.http.conn.HttpHostConnectException: Connection to your_hostURL refused
at com.pega.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:158)
at com.pega.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:149)
at com.pega.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:121)
at com.pega.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:573)
at com.pega.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:425)
at com.pega.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820)
at com.pega.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:754)
at com.pegarules.generated.activity.ra_action_pyinvokerestconnector_b036b22aea542eb41da83b1e1dbee510.step5_circum0(ra_action_pyinvokerestconnector_b036b22aea542eb41da83b1e1dbee510.java:1242)
... 72 more
Caused by:
java.net.ConnectException: A remote host refused an attempted connect operation.
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:383)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:245)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:232)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:377)
at java.net.Socket.connect(Socket.java:539)
at com.ibm.jsse2.tc.connect(tc.java:576)
at com.pega.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:376)
at com.pega.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:148)
Steps to Reproduce
Call rest service from application.
Root Cause
A defect or configuration issue in the operating environment. The error indicates that a firewall or proxy in the middle is refusing the connection.
Resolution
Make the following change to the operating environment:
Open the required port and make the Rest endpoint URL point specifically to it.
Published June 17, 2016 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.