NoClassDefFound error for ShapeBuilder

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

Can someone please help me

Read this 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.

Found the solution. Had to add the jts dependency per 6.7.1 geo query documentation

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