Elasticsearch 6.0.1 NoSuchFieldError: LUCENE_6_0_0
Asked Answered
A

4

5

I am using elasticsearch 6.0.1 and on BulkRequest request = new BulkRequest(); I am getting the below error. I have checked online, mostly people said that this happens if I have different versions of lucene jars in the classpath.

java.lang.NoSuchFieldError: LUCENE_6_0_0

at org.elasticsearch.Version.<clinit>(Version.java:44)
at org.elasticsearch.common.logging.DeprecationLogger.<clinit>(DeprecationLogger.java:159)
at org.elasticsearch.action.bulk.BulkRequest.<clinit>(BulkRequest.java:67)
at com.gci.geospatial_analysis.db.es.EsIndexClient.insert_layer_metadata_bulk(EsIndexClient.java:19)
at com.gci.geospatial_analysis.ElasticsearchTest.insert_documents_test1(ElasticsearchTest.java:17)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

Below is my pom and I don't think that I have any other lucene version in classpath.

<dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-lang3</artifactId>
    <version>3.7</version>
</dependency>

<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
<dependency>
  <groupId>com.fasterxml.jackson.core</groupId>
  <artifactId>jackson-core</artifactId>
  <version>2.9.3</version>
</dependency>

<dependency>
  <groupId>com.fasterxml.jackson.dataformat</groupId>
  <artifactId>jackson-dataformat-xml</artifactId>
  <version>2.9.3</version>
</dependency>

<dependency>
  <groupId>com.fasterxml.jackson.core</groupId>
  <artifactId>jackson-databind</artifactId>
  <version>2.9.3</version>
</dependency>

<dependency>
  <groupId>com.mashape.unirest</groupId>
  <artifactId>unirest-java</artifactId>
  <version>1.4.9</version>
</dependency>

<!-- https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api -->
<dependency>
  <groupId>javax.xml.bind</groupId>
  <artifactId>jaxb-api</artifactId>
  <version>2.2.11</version>
</dependency>

<!-- https://mvnrepository.com/artifact/de.l3s.boilerpipe/boilerpipe -->
<dependency>
  <groupId>de.l3s.boilerpipe</groupId>
  <artifactId>boilerpipe</artifactId>
  <version>1.1.0</version>
</dependency>


<dependency>
  <groupId>edu.stanford.nlp</groupId>
  <artifactId>stanford-corenlp</artifactId>
  <version>3.8.0</version>
</dependency>
<dependency>
  <groupId>edu.stanford.nlp</groupId>
  <artifactId>stanford-corenlp</artifactId>
  <version>3.8.0</version>
  <classifier>models</classifier>
</dependency>


<!-- https://mvnrepository.com/artifact/org.deeplearning4j/deeplearning4j-ui-model -->
<dependency>
  <groupId>org.deeplearning4j</groupId>
  <artifactId>deeplearning4j-ui-model</artifactId>
  <version>0.9.1</version>
</dependency>

<dependency>
  <groupId>org.deeplearning4j</groupId>
  <artifactId>deeplearning4j-nlp</artifactId>
  <version>0.9.1</version>
</dependency>
<dependency>
  <groupId>org.nd4j</groupId>
  <artifactId>nd4j-native</artifactId>
  <version>0.9.1</version>
</dependency>



<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
  <groupId>mysql</groupId>
  <artifactId>mysql-connector-java</artifactId>
  <version>6.0.6</version>
</dependency>


<!-- https://mvnrepository.com/artifact/org.sql2o/sql2o -->
<dependency>
  <groupId>org.sql2o</groupId>
  <artifactId>sql2o</artifactId>
  <version>1.5.4</version>
</dependency>

<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
  <groupId>junit</groupId>
  <artifactId>junit</artifactId>
  <version>4.12</version>
  <scope>test</scope>
</dependency>

<!-- https://mvnrepository.com/artifact/log4j/log4j -->
<dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>1.2.17</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.elasticsearch/elasticsearch -->
<dependency>
  <groupId>org.elasticsearch</groupId>
  <artifactId>elasticsearch</artifactId>
  <version>6.1.1</version>
</dependency>

<dependency>
  <groupId>org.elasticsearch.client</groupId>
  <artifactId>elasticsearch-rest-high-level-client</artifactId>
  <version>6.1.1</version>
</dependency>

Any help would be much appreciated.

Amalbergas answered 18/1, 2018 at 3:38 Comment(0)
D
6

This problem can be solved by looking at the elasticsearch dependency and introducing the corresponding jar package. to see : enter image description here

Diaphaneity answered 4/3, 2019 at 14:58 Comment(0)
A
4

I solved the problem by adding lucene-core as dependency.

  <dependency>
  <groupId>org.apache.lucene</groupId>
  <artifactId>lucene-core</artifactId>
  <version>7.1.0</version>
</dependency>
Amalbergas answered 20/1, 2018 at 23:15 Comment(0)
P
0

I solved this by excluding the lucene dependency in that particular jar, as my project was using couple other versions of lucene via elasticsearch :

<dependency>  <!-- This uses Lucene Core 5.4.1 -->
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-elasticsearch</artifactId>
        <version>1.4.4.RELEASE</version>
</dependency>
<dependency> <!-- This uses Lucene Core 7.3.1, hence excluding & keeping older version.-->
        <groupId>com.intuit.fuzzymatcher</groupId>
        <artifactId>fuzzy-matcher</artifactId>
        <version>1.0.3</version>
        <exclusions>
            <exclusion>
                <groupId>org.apache.lucene</groupId>
                <artifactId>lucene-core</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.apache.lucene</groupId>
                <artifactId>lucene-analyzers-common</artifactId>
            </exclusion>
        </exclusions>
</dependency>

In your case decide which version you want to keep and in the exclude all the rest. It would take a couple of tries but works for sure.

Punkah answered 16/9, 2020 at 6:38 Comment(0)
W
0

None of the answers previously shown on this page worked for me. The issue for me was that my index name had a capital letter in it. Of course, by the time the error bubbled up into the Elastic Search client, it was this generic no field exception rather than something more informative.

BAD INDEX NAME: "index_A"

GOOD INDEX NAME: "index_a"

Weatherboard answered 17/8, 2021 at 13:13 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.