# Hello, how should I initialization PreBuiltXPackTransportClient I opened the x - pack

**URL:** https://discuss.elastic.co/t/hello-how-should-i-initialization-prebuiltxpacktransportclient-i-opened-the-x-pack/188983
**Category:** Elasticsearch
**Created:** [July 5, 2019, 1:28am UTC](https://discuss.elastic.co/t/hello-how-should-i-initialization-prebuiltxpacktransportclient-i-opened-the-x-pack/188983 "2019-07-05T01:28:43Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![zhaoyunxing92](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zhaoyunxing92/32/49466_2.png) [@zhaoyunxing92](https://discuss.elastic.co/u/zhaoyunxing92)
#### Post date: [July 5, 2019, 1:28am UTC](https://discuss.elastic.co/t/hello-how-should-i-initialization-prebuiltxpacktransportclient-i-opened-the-x-pack/188983/1 "2019-07-05T01:28:44Z")

</div>

Hello, how should I initialization PreBuiltXPackTransportClient I opened the x - pack

**Elasticsearch version** :  
6.5.4  
**Plugins installed** :  
x-pack  
**JVM version** :  
jdk1.8  
**OS version** :  
win10  
**Description of the problem including expected versus actual behavior** :  
I see official support only to es6.0，[https://www.elastic.co/guide/en/x-pack/current/xpack-settings.html](https://www.elastic.co/guide/en/x-pack/current/xpack-settings.html)

```java
Settings settings = Settings.builder()
                  // es 集群的名称
                  .put("cluster.name", "elasticsearch")
                  .put("client.transport.sniff", "true")
                  //账号密码
                  .put("xpack.security.user", "elastic:123456")
                  .build();
          client = new PreBuiltXPackTransportClient(settings)
                  //添加集群节点
                  .addTransportAddresses(new InetSocketTransportAddress(InetAddress.getByName("127.0.0.1"), 9300);

```

The exception that occurs after this setting

```auto
java.lang.NoSuchMethodError: org.elasticsearch.common.settings.Settings$Builder.put([Ljava/lang/Object;)Lorg/elasticsearch/common/settings/Settings$Builder

```

---

<div class="post-metadata">

### Author: ![zhaoyunxing92](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zhaoyunxing92/32/49466_2.png) [@zhaoyunxing92](https://discuss.elastic.co/u/zhaoyunxing92)
#### Post date: [July 5, 2019, 2:23am UTC](https://discuss.elastic.co/t/hello-how-should-i-initialization-prebuiltxpacktransportclient-i-opened-the-x-pack/188983/2 "2019-07-05T02:23:13Z")

</div>

Has been resolved:grinning:

---

<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: [July 5, 2019, 6:57am UTC](https://discuss.elastic.co/t/hello-how-should-i-initialization-prebuiltxpacktransportclient-i-opened-the-x-pack/188983/3 "2019-07-05T06:57:28Z")

</div>

It'd be great for the community if you can share the code which fixed it.  
Also, I'd recommend switching to the rest client as the TransportClient is removed in 8.0.

---

<div class="post-metadata">

### Author: ![zhaoyunxing92](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zhaoyunxing92/32/49466_2.png) [@zhaoyunxing92](https://discuss.elastic.co/u/zhaoyunxing92)
#### Post date: [July 7, 2019, 2:30am UTC](https://discuss.elastic.co/t/hello-how-should-i-initialization-prebuiltxpacktransportclient-i-opened-the-x-pack/188983/4 "2019-07-07T02:30:53Z")

</div>

It's caused by version inconsistency

---

<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: [August 4, 2019, 2:30am UTC](https://discuss.elastic.co/t/hello-how-should-i-initialization-prebuiltxpacktransportclient-i-opened-the-x-pack/188983/5 "2019-08-04T02:30:56Z")

</div>

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