# Elastic search 5.0 java transport client not working

**URL:** <https://discuss.elastic.co/t/elastic-search-5-0-java-transport-client-not-working/66956>\
**Category:** Elasticsearch\
**Created:** [November 23, 2016, 8:42am UTC](https://discuss.elastic.co/t/elastic-search-5-0-java-transport-client-not-working/66956 "2016-11-23T08:42:37Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![banu](https://avatars.discourse-cdn.com/v4/letter/b/2acd7d/32.png) [@banu](https://discuss.elastic.co/u/banu)\
**Post date:** [November 23, 2016, 8:42am UTC](https://discuss.elastic.co/t/elastic-search-5-0-java-transport-client-not-working/66956/1 "2016-11-23T08:42:37Z")

</div>

For the below code.

The preBuildTransportClient class asks to two parameters.

import org.elasticsearch.client.transport.TransportClient;  
import org.elasticsearch.common.settings.Settings;  
import org.elasticsearch.common.transport.InetSocketTransportAddress;  
import org.elasticsearch.transport.client.PreBuiltTransportClient;

public class EsTest {

```
public static void main(String[] args) {
	
	 Settings settings = Settings.builder()
             .put("cluster.name", "my-application")
             .put("client.transport.sniff", true)
             .build();

     TransportClient client = new PreBuiltTransportClient(settings);

     client.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("192.168.32.124"), 9300));

}

```

}

We have added transport-5.0.1 jar. Could you please suggest which jar we could use to solve this issue in elasticsearch version 5 ?

---

<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:** [November 23, 2016, 9:00am UTC](https://discuss.elastic.co/t/elastic-search-5-0-java-transport-client-not-working/66956/2 "2016-11-23T09:00:04Z")

</div>

Please format your code using `</>` icon. It will make your post more readable.

Can you tell what exactly the issue is?

---

<div class="post-metadata">

**Author:** ![banu](https://avatars.discourse-cdn.com/v4/letter/b/2acd7d/32.png) [@banu](https://discuss.elastic.co/u/banu)\
**Post date:** [November 23, 2016, 9:54am UTC](https://discuss.elastic.co/t/elastic-search-5-0-java-transport-client-not-working/66956/3 "2016-11-23T09:54:34Z")

</div>

> [@banu](#):
>
> PreBuiltTransportClient

Dependency error PreBuiltTransportClient. The constructor PreBuiltTransportClient(Settings) is undefined. How to fix 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:** [November 23, 2016, 10:28am UTC](https://discuss.elastic.co/t/elastic-search-5-0-java-transport-client-not-working/66956/4 "2016-11-23T10:28:36Z")

</div>

May be you did not add all the needed dependencies because you are not using something like Maven?

Did you follow the guide here: [https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/\_maven\_repository.html](https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/_maven_repository.html) ?

---

<div class="post-metadata">

**Author:** ![banu](https://avatars.discourse-cdn.com/v4/letter/b/2acd7d/32.png) [@banu](https://discuss.elastic.co/u/banu)\
**Post date:** [November 23, 2016, 11:19am UTC](https://discuss.elastic.co/t/elastic-search-5-0-java-transport-client-not-working/66956/5 "2016-11-23T11:19:55Z")

</div>

We are not using maven but we have included all the dependencies. But still getting error ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.

---

<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:** [November 23, 2016, 11:32am UTC](https://discuss.elastic.co/t/elastic-search-5-0-java-transport-client-not-working/66956/6 "2016-11-23T11:32:56Z")

</div>

Try searching for the error message you got:

`No log4j2 configuration file found. Using default configuration:`

with your favorite search engine, there are a couple relevant threads over on Stackoverflow that might help you out here.

---

<div class="post-metadata">

**Author:** ![banu](https://avatars.discourse-cdn.com/v4/letter/b/2acd7d/32.png) [@banu](https://discuss.elastic.co/u/banu)\
**Post date:** [November 23, 2016, 11:46am UTC](https://discuss.elastic.co/t/elastic-search-5-0-java-transport-client-not-working/66956/7 "2016-11-23T11:46:15Z")

</div>

We are getting this exception in elasticsearch5 how to fix this issue ?  
We have already tried but no luck ...  
Exception in thread "main" NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{G3cU-l9lQhO9ZFJhEvkrEA}{127.0.0.1}{127.0.0.1:9300}]]

---

<div class="post-metadata">

**Author:** ![arvind](https://avatars.discourse-cdn.com/v4/letter/a/a6a055/32.png) [@arvind](https://discuss.elastic.co/u/arvind)\
**Post date:** [November 23, 2016, 11:55am UTC](https://discuss.elastic.co/t/elastic-search-5-0-java-transport-client-not-working/66956/8 "2016-11-23T11:55:02Z")

</div>

It seems that elatic search instance you started did not start with the default transport client i.e 9300 set in the elasticsearch.yml file having the value transport client set to 9300.

Check your transport client port which appears when you start the elastic search and copy that port to the transportclient variable in the elasticsearch.yml file.  
This might solve your problem and then re-start your elastic search and check that the port you mentioned is the same as the transport client value when elasticsearch starts.

---

<div class="post-metadata">

**Author:** ![banu](https://avatars.discourse-cdn.com/v4/letter/b/2acd7d/32.png) [@banu](https://discuss.elastic.co/u/banu)\
**Post date:** [November 23, 2016, 12:38pm UTC](https://discuss.elastic.co/t/elastic-search-5-0-java-transport-client-not-working/66956/9 "2016-11-23T12:38:33Z")

</div>

Thank you for the suggestions its working now 🙂

---

<div class="post-metadata">

**Author:** ![arvind](https://avatars.discourse-cdn.com/v4/letter/a/a6a055/32.png) [@arvind](https://discuss.elastic.co/u/arvind)\
**Post date:** [November 23, 2016, 12:43pm UTC](https://discuss.elastic.co/t/elastic-search-5-0-java-transport-client-not-working/66956/10 "2016-11-23T12:43:11Z")

</div>

👍 great 🙂

---

<div class="post-metadata">

**Author:** ![banu](https://avatars.discourse-cdn.com/v4/letter/b/2acd7d/32.png) [@banu](https://discuss.elastic.co/u/banu)\
**Post date:** [November 23, 2016, 1:15pm UTC](https://discuss.elastic.co/t/elastic-search-5-0-java-transport-client-not-working/66956/11 "2016-11-23T13:15:23Z")

</div>

Does the search template option is removed in elasticsearch 5.0. Please refer the link of version 1.6 [https://www.elastic.co/guide/en/elasticsearch/client/java-api/1.6/java-search-template.html](https://www.elastic.co/guide/en/elasticsearch/client/java-api/1.6/java-search-template.html) but there is no option for version 5. How to do template queries in elasticsearch 5 ?

---

<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:** [November 23, 2016, 1:29pm UTC](https://discuss.elastic.co/t/elastic-search-5-0-java-transport-client-not-working/66956/12 "2016-11-23T13:29:38Z")

</div>

I think the documentation page you are looking for now lives here:

[https://www.elastic.co/guide/en/elasticsearch/client/java-api/5.x/java-specialized-queries.html#java-query-dsl-template-query](https://www.elastic.co/guide/en/elasticsearch/client/java-api/5.x/java-specialized-queries.html#java-query-dsl-template-query)

---

<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:** [December 21, 2016, 1:30pm UTC](https://discuss.elastic.co/t/elastic-search-5-0-java-transport-client-not-working/66956/13 "2016-12-21T13:30:08Z")

</div>

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