An Oozie Java action is executed on a Hadoop cluster. Could it be that www.thomas-bayer.com:80
is not accessible from the cluster? You can easily verify that by logging into the nodes and trying to call your REST api from there.
REST Connection is refused in Oozie Java action node but succeeds in Eclipse and command line
Question
We have an Oozie workflow with Java action node, which is supposed to call out another REST web service. Let us use a sample REST API link, http://www.thomas-bayer.com/sqlrest/INVOICE/10, as an example.
I build a small Java app that can get connected the web service and print some info back. It's implemented via Eclipse and works perfectly fine in Eclipse and command line. Then I upload the jar file and ask Oozie to invoke that jar. Oozie launcher can find that jar and launch it, but the connection is refused by the web service, http://www.thomas-bayer.com/sqlrest/INVOICE/10.
Logs below:
Invoking Main class now >>> Start web service calling ... <<< Invocation of Main class completed <<< Oozie Launcher ends
stderr logs org.apache.http.conn.HttpHostConnectException: Connect to www.thomas-bayer.com:80 [www.thomas-bayer.com/80.152.243.114] failed: Connection refused at org.apache.http.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:138) at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:314) at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:363) at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:219) at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195) at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:85) at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108) at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:186) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
Solution