Caused by: java.lang.NoClassDefFoundError: org/apache/lucene/search/join/ToParentBlockJoinQuery

Elasticsearch version : elasticsearch.jar:6.3.2
Exception: Caused by: java.lang.NoClassDefFoundError: org/apache/lucene/search/join/ToParentBlockJoinQuery

Problem Description

I was trying to sort a field of a document using code

searchSourceBuilder.sort("create_date", SortOrder.DESC);

it worked when I was debugging in my local machine, it does sort the field by descding order,

but when I am trying to deploy the project in production enviroment, I just got the exception messgag below.

I am really hope that someone can help me out of the messy.
It troubles me for almost 2 days, thank you.

Exception Message

Caused by: java.lang.NoClassDefFoundError: org/apache/lucene/search/join/ToParentBlockJoinQuery
	at org.elasticsearch.search.sort.SortBuilders.fieldSort(SortBuilders.java:46)
	at org.elasticsearch.search.builder.SearchSourceBuilder.sort(SearchSourceBuilder.java:465)
	at scn.microke.web.core.CloudQuestionController.searchQuestion(CloudQuestionController.java:183)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)
	... 86 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.apache.lucene.search.join.ToParentBlockJoinQuery
	at java.net.URLClassLoader.findClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	... 100 common frames omitted

It looks like you are missing a jar. How are you adding the elasticsearch client to you application? Are you using the transport client? Which elasticsearch jars do you have?

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