# Not able to create the TransportClient of the PreBuiltXPackTransportClient

**URL:** <https://discuss.elastic.co/t/not-able-to-create-the-transportclient-of-the-prebuiltxpacktransportclient/106643>\
**Category:** Elasticsearch\
**Created:** [November 7, 2017, 8:35am UTC](https://discuss.elastic.co/t/not-able-to-create-the-transportclient-of-the-prebuiltxpacktransportclient/106643 "2017-11-07T08:35:54Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mukesh\_Soni](https://avatars.discourse-cdn.com/v4/letter/m/b38774/32.png) [@Mukesh\_Soni](https://discuss.elastic.co/u/Mukesh_Soni)\
**Post date:** [November 7, 2017, 8:35am UTC](https://discuss.elastic.co/t/not-able-to-create-the-transportclient-of-the-prebuiltxpacktransportclient/106643/1 "2017-11-07T08:35:54Z")

</div>

I am trying to create the Transport client of the PreBuiltXPackTransportClient but getting the below exception:

[err] NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{C5U0OGnqQ0uL4m-\_haFBNg}{127.0.0.1}{127.0.0.1:9300}]]

Below is my configuration:

TransportClient client = new PreBuiltXPackTransportClient(Settings.builder()  
.put("[cluster.name](http://cluster.name)", "elasticsearch")  
.put("xpack.security.user", "transport\_client\_user:changeme")  
.build()).addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("127.0.0.1"), port));

I have installed the x-pack security feature and its working fine through the rest call but I am facing issue to create the client in java code.

Please help me to resolve the issue.

Thanks in advance.

---

<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 7, 2017, 8:55am UTC](https://discuss.elastic.co/t/not-able-to-create-the-transportclient-of-the-prebuiltxpacktransportclient/106643/2 "2017-11-07T08:55:16Z")

</div>

It should work well like this I think.

May be share elasticsearch logs, formatted please with `</>` icon.

Also format your code the same way please.

BTW Transport Client will be deprecated in the future. May be better to switch now to the Rest Client instead?

---

<div class="post-metadata">

**Author:** ![Mukesh\_Soni](https://avatars.discourse-cdn.com/v4/letter/m/b38774/32.png) [@Mukesh\_Soni](https://discuss.elastic.co/u/Mukesh_Soni)\
**Post date:** [November 7, 2017, 10:22am UTC](https://discuss.elastic.co/t/not-able-to-create-the-transportclient-of-the-prebuiltxpacktransportclient/106643/3 "2017-11-07T10:22:57Z")

</div>

Hi David,

Thanks for reply.

Please find below the elasticsearch logs:

```auto
[2017-11-07T05:12:58,149][ERROR][o.e.x.s.a.e.NativeUsersStore] [b3l2K7J] failed to retrieve user [transport_client_user]
org.elasticsearch.cluster.block.ClusterBlockException: blocked by: [SERVICE_UNAVAILABLE/1/state not recovered / initialized];
	at org.elasticsearch.cluster.block.ClusterBlocks.globalBlockedException(ClusterBlocks.java:165) ~[elasticsearch-5.6.3.jar:5.6.3]
	at org.elasticsearch.action.support.single.shard.TransportSingleShardAction.checkGlobalBlock(TransportSingleShardAction.java:105) ~[elasticsearch-5.6.3.jar:5.6.3]
	at org.elasticsearch.action.support.single.shard.TransportSingleShardAction$AsyncSingleAction.<init>(TransportSingleShardAction.java:139) ~[elasticsearch-5.6.3.jar:5.6.3]/>

```

---

<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 7, 2017, 10:39am UTC](https://discuss.elastic.co/t/not-able-to-create-the-transportclient-of-the-prebuiltxpacktransportclient/106643/4 "2017-11-07T10:39:58Z")

</div>

So `transport_client_user` has not been created.

May be you did not read that? [https://www.elastic.co/guide/en/x-pack/current/java-clients.html](https://www.elastic.co/guide/en/x-pack/current/java-clients.html)

BTW I moved your question to #x-pack

---

<div class="post-metadata">

**Author:** ![Mukesh\_Soni](https://avatars.discourse-cdn.com/v4/letter/m/b38774/32.png) [@Mukesh\_Soni](https://discuss.elastic.co/u/Mukesh_Soni)\
**Post date:** [November 7, 2017, 10:50am UTC](https://discuss.elastic.co/t/not-able-to-create-the-transportclient-of-the-prebuiltxpacktransportclient/106643/5 "2017-11-07T10:50:17Z")

</div>

Thanks Devid

Where I need to create the transport\_client\_user as I have put this in my configuration.java

```
        Settings.builder()
        .put("xpack.security.user", "transport_client_user:changeme")

```

I am able to hit the elastic search with [http://elastic:changeme@localhost:9200](http://elastic:changeme@localhost:9200) this means the x-pack configuration is working fine with the elastic/changeme username/password.

---

<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 7, 2017, 11:20am UTC](https://discuss.elastic.co/t/not-able-to-create-the-transportclient-of-the-prebuiltxpacktransportclient/106643/6 "2017-11-07T11:20:28Z")

</div>

I believe you can do it in Kibana -\> Management -\> Users  
Otherwise using the API: [https://www.elastic.co/guide/en/x-pack/current/native-realm.html#native-add](https://www.elastic.co/guide/en/x-pack/current/native-realm.html#native-add)

---

<div class="post-metadata">

**Author:** ![Mukesh\_Soni](https://avatars.discourse-cdn.com/v4/letter/m/b38774/32.png) [@Mukesh\_Soni](https://discuss.elastic.co/u/Mukesh_Soni)\
**Post date:** [November 7, 2017, 4:07pm UTC](https://discuss.elastic.co/t/not-able-to-create-the-transportclient-of-the-prebuiltxpacktransportclient/106643/7 "2017-11-07T16:07:12Z")

</div>

Hi David,

Thanks you.

Still I am getting the below exception:

[err] NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{YLKYvxd5QguJeo1j4kYiMw}{127.0.0.1}{127.0.0.1:9300}]]

I have created the user:

```
POST /_xpack/security/user/jacknich
    {
      "password" : "password", 
      "roles" : ["admin", "superuser"], 
      "full_name" : "Jack Nicholson", 
      "email" : "jacknich@example.com", 
      "metadata" : { 
        "intelligence" : 7
      },
      "enabled": true 
    }

```

After that I have changed the configuration :

```
    Settings.builder()
    		        .put("cluster.name", "elasticsearch")
    		        .put("xpack.security.user", "transport_client_user:jacknich")

```

The username and password is same jacknich/jacknich.

---

<div class="post-metadata">

**Author:** ![Mukesh\_Soni](https://avatars.discourse-cdn.com/v4/letter/m/b38774/32.png) [@Mukesh\_Soni](https://discuss.elastic.co/u/Mukesh_Soni)\
**Post date:** [November 7, 2017, 4:19pm UTC](https://discuss.elastic.co/t/not-able-to-create-the-transportclient-of-the-prebuiltxpacktransportclient/106643/8 "2017-11-07T16:19:14Z")

</div>

The issue has been resolved by changing below

```
        Settings.builder()
            		        .put("cluster.name", "elasticsearch")
            		        .put("xpack.security.user", "jacknich:jacknich")

```

There was an issue with the transport\_client\_user attribute we need to pass the created username here  
David Thanks a lot for your help 🙂

---

<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 5, 2017, 4:19pm UTC](https://discuss.elastic.co/t/not-able-to-create-the-transportclient-of-the-prebuiltxpacktransportclient/106643/9 "2017-12-05T16:19:50Z")

</div>

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