NodesNotAvailable for java client

Hello Elastic Team.
My name is Kanagat.
I am trying configurate connection to Elk node from java by transport client.But i get exception: noNodesAvailable.

next my ELK configuration running on server with name XXX:
elasticsearch-5.0.2] cat ./config/elasticsearch.yml |grep -v "#" |grep -v "^"

cluster.name: eventhandler-test-db
node.name: node-3
node.master: true
node.data: true
path.logs: /data/nugusbayev_repo/logs/elasticsearch/node3
network.publish_host: SERVER_NAME
network.bind_host: 0.0.0.0
discovery.zen.ping.unicast.hosts: ["127.0.0.1", "localhost","SERVER_NAME"]

curl localhost:9200
{
"name" : "node-3",
"cluster_name" : "eventhandler-test-db",
"cluster_uuid" : "xb38NQ14SNuyh1eUKA0LbA",
"version" : {
"number" : "5.0.2",
"build_hash" : "f6b4951",
"build_date" : "2016-11-24T10:07:18.101Z",
"build_snapshot" : false,
"lucene_version" : "6.2.1"
},
"tagline" : "You Know, for Search"
}
SERVER_NAME:9200
this url permitted(accesed) from any PC in our network.

Then i tried use in java project
Settings settings = Settings.builder().put("cluster.name", "eventhandler-test-db").build();
TransportClient client = new PreBuiltTransportClient(settings);
client.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("SERVER_NAME"), 9300));
System.out.println("QQQ" + client.connectedNodes());

But client not return any nodes.
Can you help me what's wrong in my configuration?

In addition i add the screen of used libraries.

Hey,

try to also configure the cluster name in your transport client settings.

See configuring the transport client

--Alex

Alex, thanks you.
But i configured by that instructions.
It didn't work.

Settings settings = Settings.builder().put("cluster.name", "eventhandler-test-db").build();
TransportClient client = new PreBuiltTransportClient(settings);
client.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("SERVER_NAME"), 9300));
System.out.println("QQQ" + client.connectedNodes());

Hey,

sorry I missed that - didnt have any coffee yet.

Can you configure the settings logger.level to debug or trace on the TransportClient, try again and paste the output?

--Alex

I configure with command:
curl -XPUT localhost:9200/_cluster/settings -d '{
"transient" : {
"logger.org.elasticsearch.transport.TransportService.tracer" : "TRACE"
}
}'
Then in the log file appeared next rows:

[2016-12-05T16:21:24,403][TRACE][o.e.t.T.tracer ] [node-3] [111][cluster:monitor/nodes/stats[n]] received response from [{node-3}{UkLFi01ZTym58721RqGSBw}{VD0lbEHaT_yCodRoQBXf_Q}{10.17.100.194}{1
0.17.100.194:9300}]
[2016-12-05T16:21:24,404][TRACE][o.e.t.T.tracer ] [node-3] [112][indices:monitor/stats[n]] received response from [{node-3}{UkLFi01ZTym58721RqGSBw}{VD0lbEHaT_yCodRoQBXf_Q}{10.17.100.194}{10.17.1
00.194:9300}]
[2016-12-05T16:21:54,406][TRACE][o.e.t.T.tracer ] [node-3] [113][cluster:monitor/nodes/stats[n]] received response from [{node-3}{UkLFi01ZTym58721RqGSBw}{VD0lbEHaT_yCodRoQBXf_Q}{10.17.100.194}{1
0.17.100.194:9300}]
[2016-12-05T16:21:54,407][TRACE][o.e.t.T.tracer ] [node-3] [114][indices:monitor/stats[n]] received response from [{node-3}{UkLFi01ZTym58721RqGSBw}{VD0lbEHaT_yCodRoQBXf_Q}{10.17.100.194}{10.17.1
00.194:9300}]

Hey,

you need to put this into the settings of the transportclient, not anywhere on the server.

--Alex

I set next configuration:
Settings settings = Settings.builder().put("cluster.name", "first").put("logger.org.elasticsearch.transport.TransportService.tracer", "TRACE")
.build();
is it correct?
Then in output of my java client i get next rows:
no modules loaded
loaded plugin [org.elasticsearch.index.reindex.ReindexPlugin]
loaded plugin [org.elasticsearch.percolator.PercolatorPlugin]
loaded plugin [org.elasticsearch.script.mustache.MustachePlugin]
loaded plugin [org.elasticsearch.transport.Netty3Plugin]
loaded plugin [org.elasticsearch.transport.Netty4Plugin]
exception caught on transport layer [[id: 0xb6ac86c5, L:/MY_COMPUTER_IP:58108 - R:grafana-dashboard-d/10.17.100.194:9300]], closing connection
org.elasticsearch.ElasticsearchException: java.lang.AbstractMethodError: org.elasticsearch.common.io.stream.StreamInput.ensureCanReadBytes(I)V
at org.elasticsearch.transport.netty4.Netty4Transport.exceptionCaught(Netty4Transport.java:326) [transport-netty4-client-5.0.1.jar:5.0.1] at org.elasticsearch.transport.netty4.Netty4Transport.exceptionCaught(Netty4Transport.java:326) [transport-netty4-client-5.0.1.jar:5.0.1]
at org.elasticsearch.transport.netty4.Netty4MessageChannelHandler.exceptionCaught(Netty4MessageChannelHandler.java:83) [transport-netty4-client-5.0.1.jar:5.0.1]
at io.netty.channel.AbstractChannelHandlerContext.invokeExceptionCaught(AbstractChannelHandlerContext.java:296) [netty-transport-4.1.6.Final.jar:4.1.6.Final]
at io.netty.channel.AbstractChannelHandlerContext.notifyHandlerException(AbstractChannelHandlerContext.java:861) [netty-transport-4.1.6.Final.jar:4.1.6.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:375) [netty-transport-4.1.6.Final.jar:4.1.6.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:359) [netty-transport-4.1.6.Final.jar:4.1.6.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:351) [netty-transport-4.1.6.Final.jar:4.1.6.Final]
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:293) [netty-codec-4.1.6.Final.jar:4.1.6.Final]
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:280) [netty-codec-4.1.6.Final.jar:4.1.6.Final]
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:396) [netty-codec-4.1.6.Final.jar:4.1.6.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:248) [netty-codec-4.1.6.Final.jar:4.1.6.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:373) [netty-transport-4.1.6.Final.jar:4.1.6.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:359) [netty-transport-4.1.6.Final.jar:4.1.6.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:351) [netty-transport-4.1.6.Final.jar:4.1.6.Final]
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1334) [netty-transport-4.1.6.Final.jar:4.1.6.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:373) [netty-transport-4.1.6.Final.jar:4.1.6.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:359) [netty-transport-4.1.6.Final.jar:4.1.6.Final]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:926) [netty-transport-4.1.6.Final.jar:4.1.6.Final]
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:129) [netty-transport-4.1.6.Final.jar:4.1.6.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:651) [netty-transport-4.1.6.Final.jar:4.1.6.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:574) [netty-transport-4.1.6.Final.jar:4.1.6.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:488) [netty-transport-4.1.6.Final.jar:4.1.6.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:450) [netty-transport-4.1.6.Final.jar:4.1.6.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:873) [netty-common-4.1.6.Final.jar:4.1.6.Final]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_65]

Caused by: java.lang.AbstractMethodError: org.elasticsearch.common.io.stream.StreamInput.ensureCanReadBytes(I)V
at org.elasticsearch.common.io.stream.FilterStreamInput.ensureCanReadBytes(FilterStreamInput.java:80) ~[elasticsearch-5.0.2.jar:5.0.2]
at org.elasticsearch.common.io.stream.StreamInput.readArraySize(StreamInput.java:892) ~[elasticsearch-5.0.2.jar:5.0.2]
at org.elasticsearch.common.io.stream.StreamInput.readMapOfLists(StreamInput.java:456) ~[elasticsearch-5.0.2.jar:5.0.2]
at org.elasticsearch.common.util.concurrent.ThreadContext$ThreadContextStruct.(ThreadContext.java:286) ~[elasticsearch-5.0.2.jar:5.0.2]
at org.elasticsearch.common.util.concurrent.ThreadContext$ThreadContextStruct.(ThreadContext.java:273) ~[elasticsearch-5.0.2.jar:5.0.2]
at org.elasticsearch.common.util.concurrent.ThreadContext.readHeaders(ThreadContext.java:135) ~[elasticsearch-5.0.2.jar:5.0.2]
at org.elasticsearch.transport.TcpTransport.messageReceived(TcpTransport.java:1203) [elasticsearch-5.0.2.jar:5.0.2]
at org.elasticsearch.transport.netty4.Netty4MessageChannelHandler.channelRead(Netty4MessageChannelHandler.java:74) ~[transport-netty4-client-5.0.1.jar:5.0.1]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:373) ~[netty-transport-4.1.6.Final.jar:4.1.6.Final]
... 20 more
failed to get node info for {#transport#-1}{sv_5dnK0QrejxHqg6Uo8Yg}{10.17.100.194}{10.17.100.194:9300}, disconnecting...
org.elasticsearch.transport.NodeDisconnectedException: [][10.17.100.194:9300][cluster:monitor/nodes/liveness] disconnected
QQQ[]
at org.elasticsearch.transport.netty4.Netty4Transport.exceptionCaught(Netty4Transport.java:326) [transport-netty4-client-5.0.1.jar:5.0.1]

Alex, i solved problem..
I replace 2 libraries:
transport-netty3-client-5.0.1 to transport-netty3-client-5.0.2
transport-netty4-client-5.0.1 to transport-netty3-client-5.0.2

Thanks a lot!

after increas the log level, i saw problem with no class found:

then i added netty handler -4.1.6.

Then i got message from my last reply.

After replace, nodes is now available.

great to see it working, thanks for posting the solution as well!

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