Java.lang.NoSuchFieldError: LUCENE_3_6


Hi guys,

I am running 1.7.2 elasticsearch server and i'm using org.elasticsearch:elasticsearch-groovy:1.7.2 client to connect on it using TransportClient.
elasticsearch-groovy come with elasticseach 1.7.2 and lucene 4.10.4 dependecy. When the TransportClient object is initialized the following error is thrown "java.lang.NoSuchFieldError: LUCENE_3_6". I couldn't find solution for this and currently i'm stuck. I would be very thankful for any hint.
This is my code:

ImmutableSettings.Builder builder = ImmutableSettings.settingsBuilder()
    builder.put("", CLUSTER_NAME).put("client.transport.sniff", true)
    Settings settings =
    client = new TransportClient(settings)

    client.addTransportAddress(new InetSocketTransportAddress("", 9300))
    IndexRequest indexRequest = new IndexRequest(tenant,table,id)
    indexRequest.source(putJsonDocument(documentTitle,description, documentContent, postDate, author))

Thanks in advanced!

(Ivan Brusic) #2

Do you have any other Lucene jars in your classpath? Are you using
Maven/Ivy for dependency management, and if so, does anything else require



Hi Ivan,

I don't have any others lucene jars on classpath, and i could make it work with version 0.20.6, but i don't want use this old version. With elasticsearch 1.7.2 my problem still persists. For dependency i use gradle, and everyting is stored on my .m2 local repository.

(David Pilato) #4

That's strange. I looked at the Lucene 4.10.4 jar and Version.LUCENE_3_6 exists there.
It's deprecated though.

So this should work.

Could you share the full stack trace?

Could you double check that your project has been cleaned when you rebuild it with elasticsearch 1.7.2?


Hi David

This is the stack trace:

[23/10/2015 11:52:39,385] ERROR errors.GrailsExceptionResolver - NoSuchFieldError occurred when processing request: [POST] /candidateDocument/uploadAjax/Xj6kf21 - parameters:
userFileDescription: dsfsdfsdf
userFileName: TODO.txt
LUCENE_3_6. Stacktrace follows:
org.codehaus.groovy.grails.web.servlet.mvc.exceptions.ControllerExecutionException: Executing action [uploadAjax] of controller [org.candidate.CandidateDocumentController] caused exception: Runtime error executing action
at grails.plugin.cache.web.filter.PageFragmentCachingFilter.doFilter(
at grails.plugin.cache.web.filter.AbstractFilter.doFilter(
at grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilter.doFilter(
at grails.plugin.springsecurity.web.authentication.RequestHolderAuthenticationFilter.doFilter(
at grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter.doFilter(
at java.util.concurrent.ThreadPoolExecutor.runWorker(
at java.util.concurrent.ThreadPoolExecutor$
Caused by: org.codehaus.groovy.grails.web.servlet.mvc.exceptions.ControllerExecutionException: Runtime error executing action
... 8 more
Caused by: java.lang.reflect.InvocationTargetException
... 8 more
Caused by: java.lang.NoSuchFieldError: LUCENE_3_6
at org.elasticsearch.Version.(
at org.elasticsearch.client.transport.TransportClient.(
at org.elasticsearch.client.transport.TransportClient.(
at org.elasticsearch.ElasticsearchFileService.put(ElasticsearchFileService.groovy:57)
at org.document.DocumentFacadeService.put(DocumentFacadeService.groovy:52)
at org.document.CandidateS3Service.$tt__put(CandidateS3Service.groovy:34)
at org.candidate.CandidateDocumentController.uploadAjax(CandidateDocumentController.groovy:85)
... 8 more


(David Pilato) #6

Did you add lucene jars to your project as well?

Can you see lucene-core-4.10.4.jar in your classpath?

May be gradle is not configured as it should be? (not a gradle user here).


Here are all the lucene jars downloaded in my .m2 repository by gradle

In the folder lucene-core i have others two folders 4.5.1 and 4.10.4, no jar found in 4.10.4, just in 4.5.1

(David Pilato) #8

So your build is incorrect.

If Gradle did not download needed jars, it means you have to fix that.


Hi David,

Problem solved!

Because of unknown reasons gradle mixed jar versions of lucene. Where gradle couldn't find/download version of 4.10.4 of lucene, version 4.5.1 were downloaded, The solution was to add also lucene in my dependecies even elasticsearcg-groovy dependency depends on lucene 4.10.4.

compile ('org.apache.lucene:lucene-core:4.10.4')


(system) #10