I'm on the latest version (1.4.4) of Elasticsearch. And Elasticsearch artifact is in my Maven dependencies, too.
But when I try to build query using QueryBuilders
, I get this Caused by: java.lang.ClassNotFoundException: com.vividsolutions.jts.geom.Coordinate
.
I'm using Elasticsearch in Groovy code. Here is my code using QueryBuilder
:
def query = QueryBuilders
.indicesQuery(QueryBuilders.filteredQuery(QueryBuilders.matchAllQuery(), FilterBuilders.termFilter('_id', someId)), indices)
.noMatchQuery("none")
So what am I missing here?
Thanks!
Read this: http://www.elasticsearch.org/guide/en/elasticsearch/client/java-api/current/query-dsl-queries.html#geo-shape
You are missing dependency here.
Hi @dadoonet ,
Thanks for the solution! It works if I add those dependencies.
However, the problem is that I don't use any geo related queries in my code. What I use in my code are just queries like aggregations, filters. And actually in the last 4 months I never had this problem, and it suddenly appears today.
Interesting. Reopening for more checks.
That's super strange. I did not manage to reproduce it.
I have a simple pom.xml
:
<properties>
<elasticsearch.version>1.4.4</elasticsearch.version>
</properties>
<dependencies>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>${elasticsearch.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.3.2</version>
<classifier>indy</classifier>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<scope>test</scope>
</dependency>
</dependencies>
And a sample code:
@Test
public void testDateRange() {
AggregationBuilder aggregation =
AggregationBuilders
.dateRange("agg")
.field("dateOfBirth")
.format("yyyy")
.addUnboundedTo("1950") // from -infinity to 1950 (excluded)
.addRange("1950", "1960") // from 1950 to 1960 (excluded)
.addUnboundedFrom("1960"); // from 1960 to +infinity
SearchResponse sr = client.prepareSearch()
.addAggregation(aggregation)
.get();
logger.info("response [{}]", sr.toString());
DateRange agg = sr.getAggregations().get("agg");
// For each entry
for (DateRange.Bucket entry : agg.getBuckets()) {
String key = entry.getKey(); // Date range as key
DateTime fromAsDate = entry.getFromAsDate(); // Date bucket from as a Date
DateTime toAsDate = entry.getToAsDate(); // Date bucket to as a Date
long docCount = entry.getDocCount(); // Doc count
logger.info("key [{}], from [{}], to [{}], doc_count [{}]", key, fromAsDate, toAsDate, docCount);
}
}
Everything looks correct.
May it's related to Groovy?
Hi @dadoonet, thanks for the effort reproducing the issue!
I don't know whether it is related to Groovy and I doubt it's because of groovy because for the past 4 or 5 month this issue never happens.
I'm trying to purge my local Maven repository, purge all remote artifacts in our Artifactory server and rebuild the project to see.
It might be depend on your data. If you have a sample mapping and some data I could try to reproduce this in Java.
Let me know how it goes.
@dadoonet
I just setup a clean environment to test Elasticsearch API. Here is what I did.
Dependencies:
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<groupId>com.tliu.demo</groupId>
<artifactId>esclient</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<java.version>1.8</java.version>
<plugin.groovy-eclipse-compiler>2.9.0-01</plugin.groovy-eclipse-compiler>
<plugin.groovy-eclipse-batch>2.3.4-01</plugin.groovy-eclipse-batch>
</properties>
<dependencies>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>1.4.4</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.4.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
</dependency>
</dependencies>
<build>
<finalName>${project.name}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<compilerId>groovy-eclipse-compiler</compilerId>
</configuration>
<dependencies>
<!-- Groovy compiler support -->
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-compiler</artifactId>
<version>${plugin.groovy-eclipse-compiler}</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-batch</artifactId>
<version>${plugin.groovy-eclipse-batch}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
EsClientFactory.java
: the same class I used in my project.
package com.tliu.demo.esclient;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.InetSocketTransportAddress;
public class EsClientFactory
{
private final Client client;
public EsClientFactory(String clusterName, String hostname, int port)
{
Settings settings = ImmutableSettings.settingsBuilder().put("cluster.name", clusterName).build();
client = new TransportClient(settings).addTransportAddress(new InetSocketTransportAddress(hostname, port));
}
public Client getClient()
{
return client;
}
public void shutdown()
{
client.close();
}
}
EsClientFactoryTest.java
:
package com.tliu.demo.esclient
import org.elasticsearch.action.search.SearchRequestBuilder
import org.elasticsearch.action.search.SearchResponse
import org.elasticsearch.client.Client
import org.elasticsearch.index.query.FilterBuilders
import org.elasticsearch.index.query.QueryBuilders
import org.junit.Before
import org.junit.Test
import org.slf4j.Logger
import org.slf4j.LoggerFactory
public class EsClientFactoryTest
{
private final Logger logger = LoggerFactory.getLogger(this.class)
EsClientFactory esClientFactory
@Before
public void before()
{
esClientFactory = new EsClientFactory("elasticsearch", "localhost", 9335)
}
@Test
public void test()
{
Client client = esClientFactory.getClient();
SearchRequestBuilder request = client.prepareSearch("patient_centric_1")
.setTypes("patient_data")
.setQuery(QueryBuilders.filteredQuery(QueryBuilders.matchAllQuery(), FilterBuilders.termFilter("_id", "100")))
logger.debug("Request: {}", request)
SearchResponse response = request.execute().actionGet()
logger.debug("Response: {}", response)
}
}
And it throws the exception at .setQuery(QueryBuilders.filteredQuery(QueryBuilders.matchAllQuery(), FilterBuilders.termFilter("_id", "100")))
I checked the QueryBuilders
source code, it uses org.elasticsearch.common.geo.builders.ShapeBuilder
, where the com.vividsolutions.jts.geom.*
was imported. But as you see in my test code, I didn't use the geoShapeQuery()
method.
Try to use QueryBuilders
in your test code.
@dadoonet
I just pushed my code to my Github: https://github.com/cooniur/esclient-demo
maybe @nknize can have a look too? Related to #9462 ?
Hey guys.
I was looking at the related mentioned issues and it looks like every issue/PR have been closed now.
Should we consider this issue as closed as well?
@cooniur Were you able to get your stuff working?
Hey @dadoonet , I'd like to test if it's still broken after we upgrade to 1.6. Will let you know the result.
Thanks!
Hey @dadoonet I did a test and found this issue is still there for me. Both the Java client and the server is on the latest version of ElasticSearch (1.6.0).
Here is the exception I got:
Caused by: java.lang.NoClassDefFoundError: com/vividsolutions/jts/geom/Coordinate
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.getDeclaredMethods(Class.java:1975)
at org.codehaus.groovy.reflection.stdclasses.CachedSAMClass$1.run(CachedSAMClass.java:101)
at org.codehaus.groovy.reflection.stdclasses.CachedSAMClass$1.run(CachedSAMClass.java:99)
at java.security.AccessController.doPrivileged(Native Method)
...
... 19 common frames omitted
Caused by: java.lang.ClassNotFoundException: com.vividsolutions.jts.geom.Coordinate
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 101 common frames omitted
I think you forgot to add optional dependencies ?
What is your dependency tree ?
@dadoonet As I mentioned before (quoted below), if I add the geo dependency com.vividsolutions:jts
, the problem will solve. However, the thing is I don't use any geo related queries in the code.
on February 25
Hi @dadoonet ,Thanks for the solution! It works if I add those dependencies.
However, the problem is that I don't use any geo related queries in my code. What I use in my code are just queries like aggregations, filters. And actually in the last 4 months I never had this problem, and it suddenly appears today.
Do you have the full stack trace?
I'm pretty sure I got the same error when writing tests for lang plugins.
May be we should mark this dep as not optional anymore ?
I can confirm I just saw this issue again in azure tests. The full stack trace is the one you already provided. Nothing more than that. :( Looking at this.
@cooniur Any chance you are running your tests from IntelliJ and not from the command line?
I mean I can reproduce the issue when running tests from IntelliJ but not with mvn test
.
Could you check please?
BTW, the full stack trace is:
Exception in thread "main" java.lang.NoClassDefFoundError: com/vividsolutions/jts/geom/Geometry
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2570)
at java.lang.Class.getMethod0(Class.java:2813)
at java.lang.Class.getMethod(Class.java:1663)
at org.junit.internal.builders.SuiteMethodBuilder.hasSuiteMethod(SuiteMethodBuilder.java:18)
at com.intellij.junit4.JUnit46ClassesRequestBuilder.collectWrappedRunners(JUnit46ClassesRequestBuilder.java:79)
at com.intellij.junit4.JUnit46ClassesRequestBuilder.getClassesRequest(JUnit46ClassesRequestBuilder.java:51)
at com.intellij.junit4.JUnit4TestRunnerUtil.buildRequest(JUnit4TestRunnerUtil.java:91)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:39)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:212)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:68)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
Caused by: java.lang.ClassNotFoundException: com.vividsolutions.jts.geom.Geometry
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 16 more
There is a specific IntelliJ Runner which might cause such an issue... ???
For information, I just opened an issue here: https://youtrack.jetbrains.com/issue/IDEA-141605
That said @cooniur, you might not be hitting the same...
Interesting. When I check Search for tests: in single module
I don't get this issue anymore.
Which makes sense to me. Might be a nice workaround.
@dadoonet I tested running my project from terminal by executing java -jar myproject.jar
(note this is not mvn test), but still got the same exception. If I run the project in IntelliJ, I get the same exceptions too.
The project is a Spring Boot project. Spring Boot version is 1.2.4.RELEASE. Groovy 2.4.3 is used via dependency org.codehaus.groovy:groovy-all
. My environment is Mac Yosemite 10.10.3.
A full stack trace is attached below.
org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[org.apache.camel.component.file.GenericFileMessage@52ad6815]
at org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1635)
at org.apache.camel.impl.DefaultExchange.setException(DefaultExchange.java:308)
at org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:254)
at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:171)
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:448)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
at org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:435)
at org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:211)
at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:175)
at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:174)
at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:101)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoClassDefFoundError: com/vividsolutions/jts/geom/Coordinate
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.getDeclaredMethods(Class.java:1975)
at org.codehaus.groovy.reflection.stdclasses.CachedSAMClass$1.run(CachedSAMClass.java:101)
at org.codehaus.groovy.reflection.stdclasses.CachedSAMClass$1.run(CachedSAMClass.java:99)
at java.security.AccessController.doPrivileged(Native Method)
at org.codehaus.groovy.reflection.stdclasses.CachedSAMClass.getDeclaredMethods(CachedSAMClass.java:99)
at org.codehaus.groovy.reflection.stdclasses.CachedSAMClass.getAbstractMethods(CachedSAMClass.java:117)
at org.codehaus.groovy.reflection.stdclasses.CachedSAMClass.getSAMMethod(CachedSAMClass.java:183)
at org.codehaus.groovy.reflection.ClassInfo.isSAM(ClassInfo.java:356)
at org.codehaus.groovy.reflection.ClassInfo.createCachedClass(ClassInfo.java:346)
at org.codehaus.groovy.reflection.ClassInfo.access$700(ClassInfo.java:38)
at org.codehaus.groovy.reflection.ClassInfo$LazyCachedClassRef.initValue(ClassInfo.java:494)
at org.codehaus.groovy.reflection.ClassInfo$LazyCachedClassRef.initValue(ClassInfo.java:485)
at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46)
at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33)
at org.codehaus.groovy.reflection.ClassInfo.getCachedClass(ClassInfo.java:108)
at org.codehaus.groovy.reflection.ReflectionCache.getCachedClass(ReflectionCache.java:107)
at org.codehaus.groovy.reflection.ParameterTypes.getParametersTypes0(ParameterTypes.java:78)
at org.codehaus.groovy.reflection.ParameterTypes.getParameterTypes(ParameterTypes.java:64)
at org.codehaus.groovy.reflection.CachedMethod.compareToCachedMethod(CachedMethod.java:155)
at org.codehaus.groovy.reflection.CachedMethod.compareTo(CachedMethod.java:137)
at java.util.ComparableTimSort.binarySort(ComparableTimSort.java:258)
at java.util.ComparableTimSort.sort(ComparableTimSort.java:203)
at java.util.Arrays.sort(Arrays.java:1246)
at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:119)
at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:81)
at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46)
at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33)
at org.codehaus.groovy.reflection.CachedClass.getMethods(CachedClass.java:257)
at groovy.lang.MetaClassImpl.populateMethods(MetaClassImpl.java:362)
at groovy.lang.MetaClassImpl.fillMethodIndex(MetaClassImpl.java:341)
at groovy.lang.MetaClassImpl.initialize(MetaClassImpl.java:3261)
at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:251)
at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:282)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getMetaClass(MetaClassRegistryImpl.java:255)
at org.codehaus.groovy.runtime.InvokerHelper.getMetaClass(InvokerHelper.java:872)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallStaticSite(CallSiteArray.java:72)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallSite(CallSiteArray.java:159)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:110)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:114)
(omitted 3)
at sun.reflect.GeneratedMethodAccessor386.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:382)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:179)
(omitted 1)
at sun.reflect.GeneratedMethodAccessor385.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:292)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016)
at groovy.lang.Closure.call(Closure.java:423)
at org.codehaus.groovy.runtime.ConvertedClosure.invokeCustom(ConvertedClosure.java:51)
at org.codehaus.groovy.runtime.ConversionHandler.invoke(ConversionHandler.java:103)
at com.sun.proxy.$Proxy171.accept(Unknown Source)
at java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1540)
at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
at sun.reflect.GeneratedMethodAccessor309.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSiteNoUnwrap.invoke(PojoMetaMethodSite.java:210)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:53)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:122)
(omitted 3)
at sun.reflect.GeneratedMethodAccessor383.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.camel.component.bean.MethodInfo.invoke(MethodInfo.java:408)
at org.apache.camel.component.bean.MethodInfo$1.doProceed(MethodInfo.java:279)
at org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:252)
... 19 common frames omitted
Caused by: java.lang.ClassNotFoundException: com.vividsolutions.jts.geom.Coordinate
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at org.springframework.boot.loader.LaunchedURLClassLoader.doLoadClass(LaunchedURLClassLoader.java:170)
at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:136)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 102 common frames omitted
It sounds like you are using Camel/Groovy and this is causing an issue because of reflection.
I'm not sure we need to fix something in Elasticsearch code base.
The work around looks ok to me so add this lib and mustache to your project and it should be fine.
@dadoonet Yeah, it looks like Groovy is the culprit. I checked our project's commit log. This issue happened after Groovy was upgraded from 2.3.x to 2.4.0.
But I'll do more test with another pure Java project to see if the problem is also there. I'll put the report here after I'm done.
Thanks!
So I'm closing this for now. Feel free to reopen if you think something could be fixed on our end but I doubt it.
Hey @dadoonet
I think now I can say for sure that this is related to Groovy. It looks like that Groovy will try to fetch the non-existent class by reflection, causing the NoClassFoundException
eventually.
How can we solve this problem?
Thanks!
@pickypg any idea?
Hey @dadoonet , @cooniur .
I just ran into this same issue. Is there any workaround/solution?
Cheers!
@luigibertolucci
Hey, the solution is add this dependency to your project (assuming you were using Maven):
<dependency>
<groupId>com.vividsolutions</groupId>
<artifactId>jts</artifactId>
<version>1.13</version>
</dependency>
@dadoonet Sorry, I was on vacation two weeks ago. :)
I believe that this is just Groovy being naive about its MetaClass generation. My only real recommendation is to try to use the invokedynamic version of Groovy, which will be faster, and hopefully bypass the naive generation.
Perhaps even better, maybe you can switch over to using the equivalent Elasticsearch Groovy (http://github.com/elastic/elasticsearch-groovy) client instead of depending on Elasticsearch directly, which adds Groovy-friendly variants to the client methods like:
SearchResponse response = client.search {
indices "patient_centric_1"
types "patient_data"
source {
query {
filtered {
filter {
term {
_id = "100"
}
}
}
}
}
}
I don't have the issue anymore when upgrdagin groovy version from 2.4.4 to 2.4.6
FYI @dadoonet The link referenced in https://github.com/elastic/elasticsearch/issues/9891#issuecomment-76124562 is dead.
@dadoonet The problem is linking to current, those links break as we change the version that current points to; it is best to point to a fixed version that will stand the test of time.
Very true. Here is a fix link: https://www.elastic.co/guide/en/elasticsearch/client/java-api/5.6/java-geo-queries.html
This issue still occurs in 6.3 I don't use GeoQueries, so why i should add the dependency to my project ?
I am still experiencing this issue as well.