ConnectException using REST client in Java

RestClient is initialised well, but while trying to use the high level client , getting the following error

java.net.ConnectException: null
        at org.apache.http.nio.pool.RouteSpecificPool.timeout(RouteSpecificPool.java:168)
        at org.apache.http.nio.pool.AbstractNIOConnPool.requestTimeout(AbstractNIOConnPool.java:561)
        at org.apache.http.nio.pool.AbstractNIOConnPool$InternalSessionRequestCallback.timeout(AbstractNIOConnPool.java:822)
        at org.apache.http.impl.nio.reactor.SessionRequestImpl.timeout(SessionRequestImpl.java:183)
        at 
org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processTimeouts(DefaultConnectingIOReactor.java:210)
        at org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processEvents(DefaultConnectingIOReactor.java:155)
        at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor.execute(AbstractMultiworkerIOReactor.java:348)
        at org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager.execute(PoolingNHttpClientConnectionManager.java:189)
        at org.apache.http.impl.nio.client.CloseableHttpAsyncClientBase.doExecute(CloseableHttpAsyncClientBase.java:67)
        at org.apache.http.impl.nio.client.CloseableHttpAsyncClientBase.access$000(CloseableHttpAsyncClientBase.java:38)
        at org.apache.http.impl.nio.client.CloseableHttpAsyncClientBase$1.run(CloseableHttpAsyncClientBase.java:57)
        at java.lang.Thread.run(Thread.java:748)

Elasticsearch cluster version: 5.6.16
Client version: 5.6.16

      for (String host : hosts) {
        httpHosts[i++] = new HttpHost(host,  9200, HttpHost.DEFAULT_SCHEME_NAME);
      }
      RestClient lowlevelClient = RestClient.builder(httpHosts).build();
      RestHighLevelClient restClient =  new RestHighLevelClient(lowlevelClient);

I could able to hit and get value with this in cluster using 9200 port

curl -XGET http://ES_IP_ADDERESS:9200/*/_search

Will add if any extra details if needed

Welcome.

We don't support anymore 5.x and 6.x.
Go to at least 7.17 or better 8.1.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.