# NoNodeException while connecting through Elasticsearch API- Java

**URL:** <https://discuss.elastic.co/t/nonodeexception-while-connecting-through-elasticsearch-api-java/72118>\
**Category:** Elasticsearch\
**Created:** [January 19, 2017, 6:24am UTC](https://discuss.elastic.co/t/nonodeexception-while-connecting-through-elasticsearch-api-java/72118 "2017-01-19T06:24:43Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![VijayKarthikeyan](https://avatars.discourse-cdn.com/v4/letter/v/8491ac/32.png) [@VijayKarthikeyan](https://discuss.elastic.co/u/VijayKarthikeyan)\
**Post date:** [January 19, 2017, 6:24am UTC](https://discuss.elastic.co/t/nonodeexception-while-connecting-through-elasticsearch-api-java/72118/1 "2017-01-19T06:24:43Z")

</div>

I have seen lot of topics in here with same title... but i couldnot get a proper solution. So am asking again.

I am getting a NoNodeException msg which is given below..

> Exception in thread "main" NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{wGBsSw61TMm99QgcPcogLw}{10.242.244.170}{10.242.244.170:9300}]]  
> at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:328)  
> at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:226)  
> at org.elasticsearch.client.transport.TransportProxyClient.execute(TransportProxyClient.java:59)  
> at org.elasticsearch.client.transport.TransportClient.doExecute(TransportClient.java:345)  
> 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 org.elasticsearch.action.ActionRequestBuilder.get(ActionRequestBuilder.java:62)  
> at elk.GETCallOnELK.callingELKWithGetMethod(GETCallOnELK.java:16)  
> at elk.ELKStackAPICallMain.main(ELKStackAPICallMain.java:9)

my code is

```
public class TransportClientConnection {

	public TransportClient callingElasticsearchAPI() throws ELKException {
		TransportClient client = null;
		try {
			client = new PreBuiltTransportClient(Settings.EMPTY)
					.addTransportAddress(new InetSocketTransportAddress(
							InetAddress.getByName("10.242.244.170"), 9300));
		} catch (UnknownHostException e) {
			throw new ELKException(e);
		}
		return client;
	}
}

public class GETCallOnELK {

	public void callingELKWithGetMethod() throws ELKException {

		TransportClientConnection creatingELKObjectForMethodCall = new TransportClientConnection();
		TransportClient clientForGET = creatingELKObjectForMethodCall
				.callingElasticsearchAPI();
		GetResponse response = clientForGET.prepareGet("logstash-2016.11.29",
				"EventLog", "AVivTmHdyF6Gdb7rRxGV").get();
		String indexName = response.getIndex();
		System.out.println("The Name of the index is :" + indexName);
	}
}

```

and a main to call these methods for a connection..

What possibly could cause this exception as I have no place in the API to mention the nodes or something.. I have a default cluster which is 'elasticsearch' and i have a single node..

Please help me solve this issue.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 19, 2017, 6:39am UTC](https://discuss.elastic.co/t/nonodeexception-while-connecting-through-elasticsearch-api-java/72118/2 "2017-01-19T06:39:16Z")

</div>

What are your server logs?

Did you bind the network host to something different than localhost?

---

<div class="post-metadata">

**Author:** ![VijayKarthikeyan](https://avatars.discourse-cdn.com/v4/letter/v/8491ac/32.png) [@VijayKarthikeyan](https://discuss.elastic.co/u/VijayKarthikeyan)\
**Post date:** [January 19, 2017, 6:43am UTC](https://discuss.elastic.co/t/nonodeexception-while-connecting-through-elasticsearch-api-java/72118/3 "2017-01-19T06:43:49Z")

</div>

I did not get anything in the log as of now for API call...

and yes I changed the yml config file to make the IP of the server where ES is running instead of using the default localhost as I must also have access to ES from remote client machines where localhost wouldn't be helpful

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 19, 2017, 7:55am UTC](https://discuss.elastic.co/t/nonodeexception-while-connecting-through-elasticsearch-api-java/72118/4 "2017-01-19T07:55:16Z")

</div>

Can you share your full logs?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 19, 2017, 7:56am UTC](https://discuss.elastic.co/t/nonodeexception-while-connecting-through-elasticsearch-api-java/72118/5 "2017-01-19T07:56:18Z")

</div>

BTW don't create a new Transport Client for every call. But I guess here it's only for test purpose.

---

<div class="post-metadata">

**Author:** ![VijayKarthikeyan](https://avatars.discourse-cdn.com/v4/letter/v/8491ac/32.png) [@VijayKarthikeyan](https://discuss.elastic.co/u/VijayKarthikeyan)\
**Post date:** [January 19, 2017, 8:14am UTC](https://discuss.elastic.co/t/nonodeexception-while-connecting-through-elasticsearch-api-java/72118/6 "2017-01-19T08:14:09Z")

</div>

yes it is for testing whether this works for my configuration..

As I said i don't have any log generated for this call.. I checked the dates to see any updates on logs but nothing is there

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 19, 2017, 11:04am UTC](https://discuss.elastic.co/t/nonodeexception-while-connecting-through-elasticsearch-api-java/72118/7 "2017-01-19T11:04:49Z")

</div>

So you don't want to share the logs?

I can't help. Sorry.

---

<div class="post-metadata">

**Author:** ![VijayKarthikeyan](https://avatars.discourse-cdn.com/v4/letter/v/8491ac/32.png) [@VijayKarthikeyan](https://discuss.elastic.co/u/VijayKarthikeyan)\
**Post date:** [January 19, 2017, 11:40am UTC](https://discuss.elastic.co/t/nonodeexception-while-connecting-through-elasticsearch-api-java/72118/8 "2017-01-19T11:40:00Z")

</div>

i could not share the logs because i dont have any logs... not that i dont want to share..

---

<div class="post-metadata">

**Author:** ![mainec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mainec/32/5557_2.png) [@mainec](https://discuss.elastic.co/u/mainec)\
**Post date:** [January 19, 2017, 12:16pm UTC](https://discuss.elastic.co/t/nonodeexception-while-connecting-through-elasticsearch-api-java/72118/9 "2017-01-19T12:16:51Z")

</div>

I think there's a misunderstanding here: What @dadoonet is asking for is not the logs for this particular API call, but the full logs of your elasticsearch cluster. It could be that your ES node didn't even start correctly, is configured to bind to the wrong network host etc.

Isabel

---

<div class="post-metadata">

**Author:** ![VijayKarthikeyan](https://avatars.discourse-cdn.com/v4/letter/v/8491ac/32.png) [@VijayKarthikeyan](https://discuss.elastic.co/u/VijayKarthikeyan)\
**Post date:** [January 24, 2017, 12:52pm UTC](https://discuss.elastic.co/t/nonodeexception-while-connecting-through-elasticsearch-api-java/72118/10 "2017-01-24T12:52:50Z")

</div>

I solved the problem myself mainec.. It is just the document that provided me wrong information, which made me code in different way.

It says that the settings does not need to configured in the API call when we use default cluster.. So i did it as the doc says. That was the problem.

I figured this out by just by adding the settings with my default cluster name mentioned in it.. and it worked without any problem.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 21, 2017, 12:53pm UTC](https://discuss.elastic.co/t/nonodeexception-while-connecting-through-elasticsearch-api-java/72118/11 "2017-02-21T12:53:24Z")

</div>

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