TransportClient.builder() hang indefinitely

I am trying to use Java 2.3 client API (ES 2.3 is installed on a Linux RH 7 Machine) to connect to ElasticSearch just a single node configuration. However its stuck at the TransportClient.builder().settings(settings).build(). I waited for 5-10 minutes and nothing happened. No exception was thrown either.

btw, I have installed Marvel and Kibana. and they are running perfect. I can access them remotely also using a web-browser.

Configuration: ES 2.3 installed on Redhat 7. with Java 1.8.
Client API Java 2.3.3 on Mac OSX

So, in the code below, its prints "here0" but no "here1" or noting beyond and just stays there indefinitely. No exception either

org.elasticsearch.common.settings.Settings settings = org.elasticsearch.common.settings.Settings
				.settingsBuilder().put("", "map_cluster").build();

		Client client = null;
		try {
			client = TransportClient.builder().settings(settings).build()
					.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("mercury"), 9300));
		} catch (UnknownHostException e) {
			// TODO Auto-generated catch block
			System.out.println("here error");
		} catch (Exception e) {

Any ideas, why this happening.

Did you set on your elasticsearch instance?

Yes, I have set it up. mercury

btw, I don't think its ES server configuration problem.
I tried to run my Java code completely offline on my laptop (as in - not connected to internet or neither to network). Still it stuck at the same "here0" and never shows "here1". Wondering, whether its the Client library issue or something related.
On another note, earlier I have extensively used ES 1.7. And everything runs perfectly through my laptop.

I wonder if Mercury is resolved to an IP address instead of using the name...

I'm typically using that

this.esClient = TransportClient.builder().build()
                .addTransportAddress(new InetSocketTransportAddress(new InetSocketAddress("", 9300)));


Nah!! I replaced with the IP address and its still stuck. I tried to debug, and this is where the program got to the last point. (This is Thread.class)

Again, nothing is showing (NO Exception on the output console)


Does it work when you access to elasticsearch from elasticsearch server?

client = TransportClient.builder().settings(settings).build()
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(""), 9300));

If it works, I assume its more on the platform related issue.

Are you able from your client machine to run a REST call like GET / for instance?

Yes, everything works from my client machine. curl etc. from command prompt. Thats how I figured out, something in my code thats not working properly. But it was hard to debug, as it didn't throw any exception.

Well, I was able to fix the issue. I think it was some kind of version conflict with Spring IO, ES, and Java 1.8. I still don't know the reason btw. I started with a "clean slate" for ES 2.3.3 (instead of porting my old code that was perfectly running ES 1.7) and one by one added the necessary entries in pom.xml.

Current working configuration is Spring IO 4.2.6. RELEASE with Java 1.8 and ES 2.3.3

Now I am able to use the same aforementioned code and inject data in ES.

thank you very much for your support in resolving the issue.