# NoClassDefFound error for ShapeBuilder

**URL:** <https://discuss.elastic.co/t/noclassdeffound-error-for-shapebuilder/176695>\
**Category:** Elasticsearch\
**Created:** [April 12, 2019, 7:14pm UTC](https://discuss.elastic.co/t/noclassdeffound-error-for-shapebuilder/176695 "2019-04-12T19:14:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![avinash\_07](https://avatars.discourse-cdn.com/v4/letter/a/ebca7d/32.png) [@avinash\_07](https://discuss.elastic.co/u/avinash_07)\
**Post date:** [April 12, 2019, 7:14pm UTC](https://discuss.elastic.co/t/noclassdeffound-error-for-shapebuilder/176695/1 "2019-04-12T19:14:17Z")

</div>

I am getting the following error during run time when parse method of ShapeBuilder is being called

```
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.elasticsearch.common.geo.builders.ShapeBuilder

```

above this error was this

```
Caused by: java.lang.NoClassDefFoundError: org/locationtech/jts/geom/Coordinate
	at org.elasticsearch.common.geo.builders.ShapeBuilder.<clinit>(ShapeBuilder.java:75) ~[elasticsearch-6.7.1.jar:6.7.1]

Caused by: java.lang.ClassNotFoundException: org.locationtech.jts.geom.Coordinate
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[?:1.8.0_172]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[?:1.8.0_172]
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) ~[?:1.8.0_172]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:1.8.0_172]
	at org.elasticsearch.common.geo.builders.ShapeBuilder.<clinit>(ShapeBuilder.java:75) ~[elasticsearch-6.7.1.jar:6.7.1]

```

I am using ShapeBuilder to create geoShapeQuery in my application.

`QueryBuilders.geoShapeQuery(fieldName,ShapeBuilder.parse(parser));`

This used to work without any issues in 6.1.2 but ever since I upgraded to 6.7.1, I am getting the above error when the above line is being executed

Here are my dependencies:

```
        <dependency>
            <groupId>org.elasticsearch</groupId>
            <artifactId>elasticsearch</artifactId>
            <version>6.7.1</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.elasticsearch.client/elasticsearch-rest-high-level-client -->
        <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>elasticsearch-rest-high-level-client</artifactId>
            <version>6.7.1</version>
        </dependency>
        <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>elasticsearch-rest-client</artifactId>
            <version>6.7.1</version>
        </dependency>
        <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>elasticsearch-rest-client-sniffer</artifactId>
            <version>6.7.1</version>
        </dependency>

```

java version - 1.8

---

<div class="post-metadata">

**Author:** ![avinash\_07](https://avatars.discourse-cdn.com/v4/letter/a/ebca7d/32.png) [@avinash\_07](https://discuss.elastic.co/u/avinash_07)\
**Post date:** [April 13, 2019, 7:53am UTC](https://discuss.elastic.co/t/noclassdeffound-error-for-shapebuilder/176695/2 "2019-04-13T07:53:30Z")

</div>

Can someone please help me

---

<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:** [April 13, 2019, 8:28am UTC](https://discuss.elastic.co/t/noclassdeffound-error-for-shapebuilder/176695/3 "2019-04-13T08:28:11Z")

</div>

Read [this](https://discuss.elastic.co/t/about-the-elasticsearch-category/21) and specifically the "Also be patient" part.

It's fine to answer on your own thread after 2 or 3 days (not including weekends) if you don't have an answer.

---

<div class="post-metadata">

**Author:** ![avinash\_07](https://avatars.discourse-cdn.com/v4/letter/a/ebca7d/32.png) [@avinash\_07](https://discuss.elastic.co/u/avinash_07)\
**Post date:** [April 14, 2019, 2:14pm UTC](https://discuss.elastic.co/t/noclassdeffound-error-for-shapebuilder/176695/4 "2019-04-14T14:14:12Z")

</div>

Found the solution. Had to add the jts dependency per [6.7.1 geo query documentation](https://www.elastic.co/guide/en/elasticsearch/client/java-api/6.7/java-geo-queries.html#java-query-dsl-geo-shape-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:** [May 12, 2019, 2:14pm UTC](https://discuss.elastic.co/t/noclassdeffound-error-for-shapebuilder/176695/5 "2019-05-12T14:14:12Z")

</div>

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