# Connecting to Elasticsearch in an executable jar

**URL:** <https://discuss.elastic.co/t/connecting-to-elasticsearch-in-an-executable-jar/104416>\
**Category:** Elasticsearch\
**Created:** [October 18, 2017, 2:51pm UTC](https://discuss.elastic.co/t/connecting-to-elasticsearch-in-an-executable-jar/104416 "2017-10-18T14:51:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bbwilliams88](https://avatars.discourse-cdn.com/v4/letter/b/df788c/32.png) [@bbwilliams88](https://discuss.elastic.co/u/bbwilliams88)\
**Post date:** [October 18, 2017, 2:51pm UTC](https://discuss.elastic.co/t/connecting-to-elasticsearch-in-an-executable-jar/104416/1 "2017-10-18T14:51:41Z")

</div>

Hello,

We recently upgraded from Elasticsearch 2x to 5.3.3. We have created executable jars that will load data into Elastic search. The jars worked fine in 2x but do not work in 5.3.3. We are getting the error: "Error finding the build shortHash.  
Stopping Elasticsearch now so it doesn't run in subtly broken ways". From researching the issue seems that connecting to elasticsearch from with in an executable jar is no longer supported. Is this the case? So the following code will no longer work in a jar?

```auto
Client client = new PreBuiltTransportClient(Settings.EMPTY)
                 .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("localhost"), 9300));

```

If this is the case is there a better way to ingest a large (50k) dataset into Elasticsearch without using the rest service?

Thanks.

---

<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:** [October 18, 2017, 3:33pm UTC](https://discuss.elastic.co/t/connecting-to-elasticsearch-in-an-executable-jar/104416/2 "2017-10-18T15:33:59Z")

</div>

> So the following code will no longer work in a jar?

It should work. I mean that I've using that for some time (I now switched to REST client) but it has always been working.

> From researching the issue seems that connecting to elasticsearch from with in an executable jar is no longer supported.

Do you have any link?

---

<div class="post-metadata">

**Author:** ![Canappeco](https://avatars.discourse-cdn.com/v4/letter/c/5fc32e/32.png) [@Canappeco](https://discuss.elastic.co/u/Canappeco)\
**Post date:** [October 19, 2017, 6:27am UTC](https://discuss.elastic.co/t/connecting-to-elasticsearch-in-an-executable-jar/104416/3 "2017-10-19T06:27:30Z")

</div>

I have the same problem when I am using Elasticsearch 5.3.0. You can see my problem [here](https://discuss.elastic.co/t/java-lang-noclassdeffounderror-org-elasticsearch-common-transport-transportaddress/103516/3).

I try to change the Elasticsearch's dependency from 5.3.0 to 5.5.2, and it finally solve the problem. In fact you should keep the same version on both sides, this is really a rude way.

So now I am using ES 5.6.3 with REST Client and never meet such problem. You can try the latest version if possible.

---

<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:** [November 16, 2017, 6:27am UTC](https://discuss.elastic.co/t/connecting-to-elasticsearch-in-an-executable-jar/104416/4 "2017-11-16T06:27:30Z")

</div>

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