# java.io.IOException: listener timeout after waiting for \[60000\] ms

**URL:** https://discuss.elastic.co/t/java-io-ioexception-listener-timeout-after-waiting-for-60000-ms/117281
**Category:** Elasticsearch
**Created:** [January 27, 2018, 3:49am UTC](https://discuss.elastic.co/t/java-io-ioexception-listener-timeout-after-waiting-for-60000-ms/117281 "2018-01-27T03:49:40Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![rupanjanbaidya](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rupanjanbaidya/32/27362_2.png) [@rupanjanbaidya](https://discuss.elastic.co/u/rupanjanbaidya)
#### Post date: [January 27, 2018, 3:49am UTC](https://discuss.elastic.co/t/java-io-ioexception-listener-timeout-after-waiting-for-60000-ms/117281/1 "2018-01-27T03:49:40Z")

</div>

I am getting the exception everytime while starting the server,

```
java.io.IOException: listener timeout after waiting for [60000] ms
	at org.elasticsearch.client.RestClient$SyncResponseListener.get(RestClient.java:661) ~[elasticsearch-rest-client-6.0.0.jar:6.0.0]
	at org.elasticsearch.client.RestClient.performRequest(RestClient.java:220) ~[elasticsearch-rest-client-6.0.0.jar:6.0.0]
	at org.elasticsearch.client.RestClient.performRequest(RestClient.java:192) ~[elasticsearch-rest-client-6.0.0.jar:6.0.0]
	at org.elasticsearch.client.RestClient.performRequest(RestClient.java:154) ~[elasticsearch-rest-client-6.0.0.jar:6.0.0]
	at com.hng.elastic.index.IndexService.indexExist(IndexService.java:42) ~[classes/:na]
	at com.hng.Application.main(Application.java:39) [classes/:na]

Exception in thread "main" com.hng.elastic.exception.IndexApiException: Error when checking for existing index.
	at com.hng.elastic.index.IndexService.indexExist(IndexService.java:54)
	at com.hng.Application.main(Application.java:39)
2018-01-27 09:15:20.102 WARN 5800 --- [pool-2-thread-1] com.hng.elastic.LoggingFailureListener : The following host just failed 10. ***.***.4:9200

```

There's no bulk operation happening. All servers are accessible through CURL from the same machine I am trying to run my RestClient implementation. Below is my implementation,

```
	@Override
	protected RestClient createInstance() throws Exception {
		List<String> serverList = serverConfig.getServer();
		HttpHost[] hosts = new HttpHost[serverList.size()];
		for (int i = 0; i < hosts.length; i++) {
			hosts[i] = HttpHost.create(serverList.get(i));
		}

		logger.info("Initiallizing Elasticsearch RestClient");
		RestClient restClient = RestClient.builder(hosts).setMaxRetryTimeoutMillis(60000)
				.setDefaultHeaders(Constants.HEADERS).setFailureListener(loggingFailureListener)
				.setRequestConfigCallback((b) -> customizeRequestConfig(b)).build();

		if (enableSniffer) {
			this.sniffer = Sniffer.builder(restClient).build();
		}
		logger.info("Initiallized Elasticsearch RestClient");
		return restClient;
	}

	private RequestConfig.Builder customizeRequestConfig(RequestConfig.Builder builder) {
		return builder.setConnectionRequestTimeout(0).setSocketTimeout(5000).setConnectTimeout(60000);
	}
```

---

<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 24, 2018, 3:50am UTC](https://discuss.elastic.co/t/java-io-ioexception-listener-timeout-after-waiting-for-60000-ms/117281/2 "2018-02-24T03:50:05Z")

</div>

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