Hi,
I am using elasticsearc 0.91.1 and I am unable to catch exception org.elasticsearch.transport.ConnectTransportException while connecting to elasticsearch using TransportClient().
Below is my code snippet:
try {
Settings settings = ImmutableSettings.settingsBuilder().put("client.transport.sniff", true).build();
logger.debug("hostname="+targetConnections.getHostname()+",port="+targetConnections.getPort());
this.client = new TransportClient(settings).addTransportAddress(new InetSocketTransportAddress(
targetConnections.getHostname(), Integer.parseInt(targetConnections.getPort())));
}catch(ElasticSearchException e) {
logger.debug("Elasticsearchexception**");
}
catch(Exception e) {
logger.debug("Exception="+e.getMessage());
}
logger.debug("Client connected to ES!!!");
On console I get following exception:
27 Jun 2013 20:55:53 DEBUG [main] - [Hijacker] creating thread_pool [generic], type [cached], keep_alive [30s]
27 Jun 2013 20:55:53 DEBUG [main] - [Hijacker] creating thread_pool [index], type [fixed], size [8], queue_size [null], reject_policy [abort], queue_type [linked]
27 Jun 2013 20:55:53 DEBUG [main] - [Hijacker] creating thread_pool [bulk], type [fixed], size [8], queue_size [null], reject_policy [abort], queue_type [linked]
27 Jun 2013 20:55:53 DEBUG [main] - [Hijacker] creating thread_pool [get], type [fixed], size [8], queue_size [null], reject_policy [abort], queue_type [linked]
27 Jun 2013 20:55:53 DEBUG [main] - [Hijacker] creating thread_pool [search], type [fixed], size [24], queue_size [1k], reject_policy [abort], queue_type [linked]
27 Jun 2013 20:55:53 DEBUG [main] - [Hijacker] creating thread_pool [percolate], type [fixed], size [8], queue_size [null], reject_policy [abort], queue_type [linked]
27 Jun 2013 20:55:53 DEBUG [main] - [Hijacker] creating thread_pool [management], type [scaling], min [1], size [5], keep_alive [5m]
27 Jun 2013 20:55:53 DEBUG [main] - [Hijacker] creating thread_pool [flush], type [scaling], min [1], size [4], keep_alive [5m]
27 Jun 2013 20:55:53 DEBUG [main] - [Hijacker] creating thread_pool [merge], type [scaling], min [1], size [4], keep_alive [5m]
27 Jun 2013 20:55:53 DEBUG [main] - [Hijacker] creating thread_pool [refresh], type [scaling], min [1], size [4], keep_alive [5m]
27 Jun 2013 20:55:53 DEBUG [main] - [Hijacker] creating thread_pool [warmer], type [scaling], min [1], size [4], keep_alive [5m]
27 Jun 2013 20:55:53 DEBUG [main] - [Hijacker] creating thread_pool [snapshot], type [scaling], min [1], size [4], keep_alive [5m]
27 Jun 2013 20:55:53 DEBUG [main] - [Hijacker] using worker_count[16], port[9300-9400], bind_host[null], publish_host[null], compress[false], connect_timeout[30s], connections_per_node[2/6/1], receive_predictor[512kb->512kb]
27 Jun 2013 20:55:53 DEBUG [main] - [Hijacker] node_sampler_interval[5s]
27 Jun 2013 20:55:53 DEBUG [elasticsearch[Hijacker][transport_client_worker][T#1]{New I/O worker #1}] - Using select timeout of 500
27 Jun 2013 20:55:53 DEBUG [elasticsearch[Hijacker][transport_client_worker][T#1]{New I/O worker #1}] - Epoll-bug workaround enabled = false
27 Jun 2013 20:55:53 DEBUG [main] - [Hijacker] adding address [[#transport#-1][inet[localhost/127.0.0.1:9300]]]
27 Jun 2013 20:55:54 DEBUG [elasticsearch[Hijacker][management][T#1]] - [Hijacker] failed to connect to node [[#transport#-1][inet[localhost/127.0.0.1:9300]]], ignoring...
org.elasticsearch.transport.ConnectTransportException: [][inet[localhost/127.0.0.1:9300]] connect_timeout[30s]
at org.elasticsearch.transport.netty.NettyTransport.connectToChannelsLight(NettyTransport.java:644)
at org.elasticsearch.transport.netty.NettyTransport.connectToNode(NettyTransport.java:606)
at org.elasticsearch.transport.netty.NettyTransport.connectToNodeLight(NettyTransport.java:575)
at org.elasticsearch.transport.TransportService.connectToNodeLight(TransportService.java:131)
at org.elasticsearch.client.transport.TransportClientNodesService$SniffNodesSampler$1.run(TransportClientNodesService.java:367)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.net.ConnectException: Connection refused: no further information: localhost/127.0.0.1:9300
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:599)
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.connect(NioClientBoss.java:150)
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.processSelectedKeys(NioClientBoss.java:105)
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.process(NioClientBoss.java:79)
at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:312)
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.run(NioClientBoss.java:42)
at org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
at org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
... 3 more
27 Jun 2013 20:55:54 DEBUG [main] - Client connected to ES!!!