Application setup is as follows:
-> ElasticSearch Server = 5.5.2
-> Dependency Jars = elasticsearch-5.2.0.jar, kucene*.jars 6.4.0, transport-5.2.0
-> Both the elasticsearch server and the java client are running on same machine
-> No change done in the elasticsearch.yml file.
Java client code :
Client client = new PreBuiltTransportClient(Settings.EMPTY).addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("10.103.22.103"),9300));
After executing the above code, i get the no node available exception as below
NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{1HrNd4q_SoOmvRGoJfE_hQ}{10.103.22.103}{10.103.22.103:9300}]]
at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:344)
at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:242)
at org.elasticsearch.client.transport.TransportProxyClient.execute(TransportProxyClient.java:59)
at org.elasticsearch.client.transport.TransportClient.doExecute(TransportClient.java:356)
at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:403)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:80)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:54)
at com.paasify.java.PMDResultParser.main(PMDResultParser.java:107)
As you have specified you are using ES server 5.5.2 and dependency jars 5.2.0 this can be the issue.
If this is just a typo and you are using compatible jars then it's fine.
From whatever you have specified here and assuming that host 10.103.22.103 and TCP port 9300 is correct, it seems that you have not specified cluster name while creating transport client.
Instead of Settings.EMPTY add this:
Settings settings = Settings.builder()
.put("cluster.name","your_cluster_name").build();
Client client = new PreBuiltTransportClient(settings);
Hope this helps!
Thanks for the prompt suggestion. Below is the list of jars that i have included in my app.
elasticsearch-5.5.2.jar
HdrHistogram-2.1.9.jar
hppc-0.7.1.jar
httpclient-4.3.1.jar
jackson-annotations-2.8.6.jar
jackson-core-2.8.6.jar
jackson-core-asl-1.8.0.jar
jackson-databind-2.8.6.jar
jackson-dataformat-cbor-2.8.6.jar
jackson-dataformat-smile-2.8.6.jar
jackson-dataformat-xml-2.8.6.jar
jackson-dataformat-yaml-2.8.6.jar
jackson-mapper-asl-1.8.0.jar
jackson-module-jaxb-annotations-2.8.6.jar
java-json.jar
jna-4.4.0.jar
joda-time-2.9.5.jar
jopt-simple-5.0.2.jar
lang-mustache-client-5.5.2.jar
log4j-1.2-api-2.8.2.jar
log4j-api-2.8.2.jar
log4j-core-2.8.2.jar
lucene-analyzers-common-6.6.0.jar
lucene-backward-codecs-6.6.0.jar
lucene-core-6.6.0.jar
lucene-grouping-6.6.0.jar
lucene-highlighter-6.6.0.jar
lucene-join-6.6.0.jar
lucene-memory-6.6.0.jar
lucene-misc-6.6.0.jar
lucene-queries-6.6.0.jar
lucene-queryparser-6.6.0.jar
lucene-sandbox-6.6.0.jar
lucene-spatial-6.6.0.jar
lucene-spatial-extras-6.6.0.jar
lucene-spatial3d-6.6.0.jar
lucene-suggest-6.6.0.jar
netty-3.9.9.Final.jar
netty-buffer-4.1.7.Final.jar
netty-codec-4.1.14.Final.jar
netty-codec-http-4.1.14.Final.jar
netty-codec-http2-4.1.14.Final.jar
netty-common-4.1.14.Final.jar
netty-example-4.1.14.Final.jar
netty-handler-4.1.14.Final.jar
netty-resolver-4.1.4.Final.jar
netty-resolver-dns-4.1.14.Final.jar
netty-transport-4.1.14.Final.jar
parent-join-client-5.5.2.jar
percolator-client-5.5.2.jar
reindex-client-5.5.2.jar
securesm-1.1.jar
snakeyaml-1.15.jar
spatial4j-0.6.jar
t-digest-3.0.jar
transport-5.5.2.jar
transport-netty3-client-5.5.2.jar
transport-netty4-client-5.5.2.jar
Also , i tried the code you mentioned about using the Settings instance(and configured a cluster name in the elasticsearch.yml) in place of Settings.EMPTY, however i still get the same error.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.