# MasterNotDiscoveredException

**URL:** <https://discuss.elastic.co/t/masternotdiscoveredexception/7470>\
**Category:** Elasticsearch\
**Created:** [April 26, 2012, 7:25am UTC](https://discuss.elastic.co/t/masternotdiscoveredexception/7470 "2012-04-26T07:25:52Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![andavar](https://avatars.discourse-cdn.com/v4/letter/a/c5a1d2/32.png) [@andavar](https://discuss.elastic.co/u/andavar)\
**Post date:** [April 26, 2012, 7:25am UTC](https://discuss.elastic.co/t/masternotdiscoveredexception/7470/1 "2012-04-26T07:25:52Z")

</div>

Dear Elasticsearch User,  
 **When I am trying to run my ES Based Java program, I got following exception**

```
 org.elasticsearch.discovery.MasterNotDiscoveredException: waited for [30s]
at org.elasticsearch.action.support.master.TransportMasterNodeOperationAction$3.onTimeout(TransportMasterNodeOperationAction.java:169)
at org.elasticsearch.cluster.service.InternalClusterService$NotifyTimeout.run(InternalClusterService.java:356)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)

<b>At the same time I have started es.batch.. But I have stopped that es.batch then the program running. Please let me know what is problem..?</b>
```

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [April 29, 2012, 4:34pm UTC](https://discuss.elastic.co/t/masternotdiscoveredexception/7470/2 "2012-04-29T16:34:54Z")

</div>

Are you starting a Java client? It means that it did not discover the  
cluster to connect to. Which discovery are you using, multicast or unicast?

On Thu, Apr 26, 2012 at 10:25 AM, andavar [andavar.laxman@gmail.com](mailto:andavar.laxman@gmail.com) wrote:

> Dear Elasticsearch User,
> 
> - When I am trying to run my ES Based Java program, I got following  
> exception \*
> 
> org.elasticsearch.action.support.master.TransportMasterNodeOperationAction$3.onTimeout(TransportMasterNodeOperationAction.java:169)  
> at
> 
> org.elasticsearch.cluster.service.InternalClusterService$NotifyTimeout.run(InternalClusterService.java:356)  
> at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown  
> Source)
> 
> ```
> *At the same time I have started es.batch.. But I have stopped that
> 
> ```
> 
> es.batch then the program running. Please let me know what is problem..?\*
> 
> --  
> View this message in context:  
> [http://elasticsearch-users.115913.n3.nabble.com/MasterNotDiscoveredException-tp3940481p3940481.html](http://elasticsearch-users.115913.n3.nabble.com/MasterNotDiscoveredException-tp3940481p3940481.html)  
> Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

**Author:** ![andavar](https://avatars.discourse-cdn.com/v4/letter/a/c5a1d2/32.png) [@andavar](https://discuss.elastic.co/u/andavar)\
**Post date:** [May 3, 2012, 5:43am UTC](https://discuss.elastic.co/t/masternotdiscoveredexception/7470/3 "2012-05-03T05:43:20Z")

</div>

Hi Kimchy,  
Thanks for your reply. Yes am starting java client with default yml settings.. Nothing I was changed there.. Always I got same exception(MasterNotDiscoveredException )

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [May 4, 2012, 9:48am UTC](https://discuss.elastic.co/t/masternotdiscoveredexception/7470/4 "2012-05-04T09:48:47Z")

</div>

So, it means that it did not join the cluster of remote servers. Probably  
multicast is not working for you. Try and configure the node client with  
unicast, or use TransportClient.

On Thu, May 3, 2012 at 8:43 AM, andavar [andavar.laxman@gmail.com](mailto:andavar.laxman@gmail.com) wrote:

> Hi Kimchy,  
> Thanks for your reply. Yes am starting java client with  
> default yml settings.. Nothing I was changed there.. Always I got same  
> exception(MasterNotDiscoveredException )
> 
> --  
> View this message in context:  
> [http://elasticsearch-users.115913.n3.nabble.com/MasterNotDiscoveredException-tp3940481p3958202.html](http://elasticsearch-users.115913.n3.nabble.com/MasterNotDiscoveredException-tp3940481p3958202.html)  
> Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

**Author:** ![andavar](https://avatars.discourse-cdn.com/v4/letter/a/c5a1d2/32.png) [@andavar](https://discuss.elastic.co/u/andavar)\
**Post date:** [May 4, 2012, 12:14pm UTC](https://discuss.elastic.co/t/masternotdiscoveredexception/7470/5 "2012-05-04T12:14:01Z")

</div>

thanks for the help Kimchy.. I am using TransportClient. Now it will work fine. I want to understand difference between the following two method of client creation..

1. Node node = nodeBuilder().client(true).settings(ImmutableSettings.settingsBuilder()  
.build()).build().start();  
Client client = node.client();

2. TransportClient client = new TransportClient(settings);  
client.addTransportAddress(new InetSocketTransportAddress("localhost",9300));

Please let me know... And also please advise me why I got that exception...

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [May 4, 2012, 1:54pm UTC](https://discuss.elastic.co/t/masternotdiscoveredexception/7470/6 "2012-05-04T13:54:13Z")

</div>

Explained here:  
[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/java-api/client.html).

On Fri, May 4, 2012 at 3:14 PM, andavar [andavar.laxman@gmail.com](mailto:andavar.laxman@gmail.com) wrote:

> thanks for the help Kimchy.. I am using TransportClient. Now it will work  
> fine. I want to understand difference between the following two method of  
> client creation..
> 
> 1. Node node =  
> nodeBuilder().client(true).settings(ImmutableSettings.settingsBuilder()  
> .build()).build().start();  
> Client client = node.client();
> 
> 2. TransportClient client = new TransportClient(settings);  
> client.addTransportAddress(new  
> InetSocketTransportAddress("localhost",9300));
> 
> Please let me know... And also please advise me why I got that  
> exception...
> 
> --  
> View this message in context:  
> [http://elasticsearch-users.115913.n3.nabble.com/MasterNotDiscoveredException-tp3940481p3962090.html](http://elasticsearch-users.115913.n3.nabble.com/MasterNotDiscoveredException-tp3940481p3962090.html)  
> Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).

---

<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:** [July 6, 2017, 3:30am UTC](https://discuss.elastic.co/t/masternotdiscoveredexception/7470/7 "2017-07-06T03:30:05Z")

</div>


