TransportClient in 2.1.x

How to create a TranspotClient in 2.1.x?

I recently updated to elastic search 2.1.x.

Iam suffering to create a TransportClient via the JAVA API.

My Code looks like

** Settings settings = Settings.settingsBuilder()**
** .put("", "tst-found2day").build();**
** Client client = TransportClient.builder().settings(settings).build().addTransportAddress(new InetSocketTransportAddress(new InetSocketAddress("localhost", 9300)));**

When i run this, i got the following error:


** at org.elasticsearch.threadpool.ThreadPool.(**
** at org.elasticsearch.client.transport.TransportClient$**

What am i doing wrong ?



What Google Guava version is in your classpath?

Guava version 18.0


I am using Gradle to build the project.

I have installed kibana and the sense plugin.
In can index via Sense, but unable to connect via java client.


Please recheck. You have an older version of Guava in your project and this is causing the runtime error.

How do you mean?

Is version 18.0 old ?

No, version 18 is correct.

Check your classpath at runtime, your program fails because your Guava is older than version 18.

I found the following entry on my classpath


before entry :


This is probably causing it.

How can i exclude the old library from the class path, related to the build.groovy ?

If Grails could use Guava 18, then it would work. But it can't. This is more a less a Grails question.

Read the docs how to shade jars

Well, i managed to exclude the Guava 10.0.1.jar from my class path.

First by renaming the file directly in the sdkman folder.
This was just to show that the right jar was pcked up.
It worked.

i renamed the file back to .jar afterwards, because it is not a prober solution.

Secondly, within Intellj, i was able to remove the 10.0.1 jar from the External Libraries section within the project structure.

This causes that the 10.0.1 jar will be excluded from the class path.

Building the war file within Intellj, also excludes this jar.

So far,