# Migration to rest client ,NoSuchFieldError: Lucene\_5\_5\_4 error

**URL:** <https://discuss.elastic.co/t/migration-to-rest-client-nosuchfielderror-lucene-5-5-4-error/134217>\
**Category:** Elasticsearch\
**Created:** [June 1, 2018, 12:07pm UTC](https://discuss.elastic.co/t/migration-to-rest-client-nosuchfielderror-lucene-5-5-4-error/134217 "2018-06-01T12:07:55Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Neha\_goswami](https://avatars.discourse-cdn.com/v4/letter/n/f475e1/32.png) [@Neha\_goswami](https://discuss.elastic.co/u/Neha_goswami)\
**Post date:** [June 1, 2018, 12:07pm UTC](https://discuss.elastic.co/t/migration-to-rest-client-nosuchfielderror-lucene-5-5-4-error/134217/1 "2018-06-01T12:07:55Z")

</div>

Hi ,

I am migrating to Elastic rest client version 5.6.9

When i try to instantiate RestHighLevelClient, i get this error:

RestHighLevelClient client = new RestHighLevelClient(restlowLevelClient);

Exception in thread "main" java.lang.NoSuchFieldError: LUCENE\_5\_5\_4  
at org.elasticsearch.Version.(Version.java:85)  
at org.elasticsearch.common.logging.DeprecationLogger.(DeprecationLogger.java:159)  
at org.elasticsearch.common.ParseField.(ParseField.java:35)  
at org.elasticsearch.client.RestHighLevelClient.lambda$getDefaultNamedXContents$46(RestHighLevelClient.java:580)  
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)  
at java.util.HashMap$EntrySpliterator.forEachRemaining(HashMap.java:1696)  
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)  
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)  
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)  
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)  
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)  
at org.elasticsearch.client.RestHighLevelClient.getDefaultNamedXContents(RestHighLevelClient.java:581)  
at org.elasticsearch.client.RestHighLevelClient.(RestHighLevelClient.java:187)  
at org.elasticsearch.client.RestHighLevelClient.(RestHighLevelClient.java:177)  
at Test.main(Test.java:140)

I have below dependencies in my pom.xml :\

\<org.elasticsearch.version\>5.6.9\</org.elasticsearch.version\>  
.....

 org.elasticsearch elasticsearch ${org.elasticsearch.version} org.elasticsearch.client elasticsearch-rest-high-level-client ${org.elasticsearch.version} org.elasticsearch.client elasticsearch-rest-client ${org.elasticsearch.version}

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 1, 2018, 12:36pm UTC](https://discuss.elastic.co/t/migration-to-rest-client-nosuchfielderror-lucene-5-5-4-error/134217/2 "2018-06-01T12:36:01Z")

</div>

What gives:

```
mvn dependency:tree
```

---

<div class="post-metadata">

**Author:** ![Neha\_goswami](https://avatars.discourse-cdn.com/v4/letter/n/f475e1/32.png) [@Neha\_goswami](https://discuss.elastic.co/u/Neha_goswami)\
**Post date:** [June 1, 2018, 1:05pm UTC](https://discuss.elastic.co/t/migration-to-rest-client-nosuchfielderror-lucene-5-5-4-error/134217/3 "2018-06-01T13:05:56Z")

</div>

> [@Neha\_goswami](#):
>
> \<org.elasticsearch.version\>5.6.9\</org.elasticsearch.version\>  
> .....
> 
> org.elasticsearch elasticsearch ${org.elasticsearch.version} org.elasticsearch.client elasticsearch-rest-high-level-client ${org.elasticsearch.version} org.elasticsearch.client elasticsearch-rest-client ${org.elasticsearch.version}

$ mvn dependency:tree  
[INFO] Scanning for projects...  
[INFO]  
[INFO] ------------------------------------------------------------------------  
[INFO] Building BoltESApplier dev  
[INFO] ------------------------------------------------------------------------  
[WARNING] The POM for com.apple.extra:ojdbc12c:jar:7.0 is missing, no dependency information available  
[WARNING] The POM for com.apple.extra:oracleucp:jar:12.1 is missing, no dependency information available  
[WARNING] The POM for com.apple.extra:boltlistener:jar:1.0 is missing, no dependency information available  
[WARNING] The POM for com.apple.extra:aqapi13:jar:1.0 is missing, no dependency information available  
[WARNING] The POM for com.apple.extra:BOLTSwitchOver-0.0.1:jar:1.0 is missing, no dependency information available  
[INFO]  
[INFO] --- maven-dependency-plugin:2.9:tree (default-cli) @ BoltESApplier ---  
[INFO] applier:BoltESApplier:jar:dev  
[INFO] +- org.apache.kafka:kafka-clients:jar:0.10.2.1:compile  
[INFO] | +- net.jpountz.lz4:lz4:jar:1.3.0:compile  
[INFO] | +- org.xerial.snappy:snappy-java:jar:1.1.2.6:compile  
[INFO] | - org.slf4j:slf4j-api:jar:1.7.21:compile  
[INFO] +- org.apache.zookeeper:zookeeper:jar:3.4.10:compile  
[INFO] | +- org.slf4j:slf4j-log4j12:jar:1.6.1:compile  
[INFO] | +- log4j:log4j:jar:1.2.16:compile  
[INFO] | +- jline:jline:jar:0.9.94:compile  
[INFO] | - io.netty:netty:jar:3.10.5.Final:compile  
[INFO] +- org.apache.kafka:kafka\_2.10:jar:0.10.2.1:compile  
[INFO] | +- net.sf.jopt-simple:jopt-simple:jar:5.0.3:compile  
[INFO] | +- com.yammer.metrics:metrics-core:jar:2.2.0:compile  
[INFO] | +- org.scala-lang:scala-library:jar:2.10.6:compile  
[INFO] | - com.101tec:zkclient:jar:0.10:compile  
[INFO] +- org.apache.curator:curator-framework:jar:2.9.1:compile  
[INFO] | - org.apache.curator:curator-client:jar:2.9.1:compile  
[INFO] | - com.google.guava:guava:jar:16.0.1:compile  
[INFO] +- org.elasticsearch:elasticsearch:jar:5.6.9:compile  
[INFO] | +- org.apache.lucene:lucene-core:jar:6.6.1:compile  
[INFO] | +- org.apache.lucene:lucene-analyzers-common:jar:6.6.1:compile  
[INFO] | +- org.apache.lucene:lucene-backward-codecs:jar:6.6.1:compile  
[INFO] | +- org.apache.lucene:lucene-grouping:jar:6.6.1:compile  
[INFO] | +- org.apache.lucene:lucene-highlighter:jar:6.6.1:compile  
[INFO] | +- org.apache.lucene:lucene-join:jar:6.6.1:compile  
[INFO] | +- org.apache.lucene:lucene-memory:jar:6.6.1:compile  
[INFO] | +- org.apache.lucene:lucene-misc:jar:6.6.1:compile  
[INFO] | +- org.apache.lucene:lucene-queries:jar:6.6.1:compile  
[INFO] | +- org.apache.lucene:lucene-queryparser:jar:6.6.1:compile  
[INFO] | +- org.apache.lucene:lucene-sandbox:jar:6.6.1:compile  
[INFO] | +- org.apache.lucene:lucene-spatial:jar:6.6.1:compile  
[INFO] | +- org.apache.lucene:lucene-spatial-extras:jar:6.6.1:compile  
[INFO] | +- org.apache.lucene:lucene-spatial3d:jar:6.6.1:compile  
[INFO] | +- org.apache.lucene:lucene-suggest:jar:6.6.1:compile  
[INFO] | +- org.elasticsearch:securesm:jar:1.2:compile  
[INFO] | +- com.carrotsearch:hppc:jar:0.7.1:compile  
[INFO] | +- joda-time:joda-time:jar:2.9.5:compile  
[INFO] | +- org.yaml:snakeyaml:jar:1.15:compile  
[INFO] | +- com.fasterxml.jackson.core:jackson-core:jar:2.8.6:compile  
[INFO] | +- com.fasterxml.jackson.dataformat:jackson-dataformat-smile:jar:2.8.6:compile  
[INFO] | +- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.8.6:compile  
[INFO] | +- com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:jar:2.8.6:compile  
[INFO] | +- com.tdunning:t-digest:jar:3.0:compile  
[INFO] | +- org.hdrhistogram:HdrHistogram:jar:2.1.9:compile  
[INFO] | +- org.apache.logging.log4j:log4j-api:jar:2.9.1:compile  
[INFO] | - org.elasticsearch:jna:jar:4.4.0-1:compile  
[INFO] +- org.elasticsearch.client:elasticsearch-rest-high-level-client:jar:5.6.9:compile  
[INFO] | +- org.elasticsearch.plugin:parent-join-client:jar:5.6.9:compile  
[INFO] | | +- org.locationtech.spatial4j:spatial4j:jar:0.6:compile  
[INFO] | | - com.vividsolutions:jts:jar:1.13:compile  
[INFO] | - org.elasticsearch.plugin:aggs-matrix-stats-client:jar:5.6.9:compile  
[INFO] +- org.elasticsearch.client:elasticsearch-rest-client:jar:5.6.9:compile  
[INFO] | +- org.apache.httpcomponents:httpclient:jar:4.5.2:compile  
[INFO] | +- org.apache.httpcomponents:httpcore:jar:4.4.5:compile  
[INFO] | +- org.apache.httpcomponents:httpasyncclient:jar:4.1.2:compile  
[INFO] | +- org.apache.httpcomponents:httpcore-nio:jar:4.4.5:compile  
[INFO] | +- commons-codec:commons-codec:jar:1.10:compile  
[INFO] | - commons-logging:commons-logging:jar:1.1.3:compile  
[INFO] +- com.googlecode.json-simple:json-simple:jar:1.1:compile  
[INFO] +- org.json:json:jar:20171018:compile  
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.7.1:compile  
[INFO] | - com.fasterxml.jackson.core:jackson-annotations:jar:2.7.0:compile  
[INFO] +- org.apache.logging.log4j:log4j-core:jar:2.9.1:compile  
[INFO] +- com.apple.extra:ojdbc12c:jar:7.0:compile  
[INFO] +- com.apple.extra:oracleucp:jar:12.1:compile  
[INFO] +- com.apple.extra:boltlistener:jar:1.0:compile  
[INFO] +- com.apple.extra:aqapi13:jar:1.0:compile  
[INFO] +- com.apple.extra:BOLTSwitchOver-0.0.1:jar:1.0:compile  
[INFO] +- org.apache.commons:commons-lang3:jar:3.6:compile  
[INFO] +- commons-io:commons-io:jar:2.6:compile  
[INFO] - javax.mail:javax.mail-api:jar:1.6.0:compile  
[INFO] ------------------------------------------------------------------------  
[INFO] BUILD SUCCESS  
[INFO] ------------------------------------------------------------------------  
[INFO] Total time: 1.516 s  
[INFO] Finished at: 2018-06-01T06:05:16-07:00  
[INFO] Final Memory: 17M/309M  
[INFO] ------------------------------------------------------------------------  
01HW1145439:BoltElasticApplier neha922102$

---

<div class="post-metadata">

**Author:** ![Neha\_goswami](https://avatars.discourse-cdn.com/v4/letter/n/f475e1/32.png) [@Neha\_goswami](https://discuss.elastic.co/u/Neha_goswami)\
**Post date:** [June 1, 2018, 1:06pm UTC](https://discuss.elastic.co/t/migration-to-rest-client-nosuchfielderror-lucene-5-5-4-error/134217/4 "2018-06-01T13:06:51Z")

</div>

and this gives::::

$ mvn dependency:tree -Dverbose -Dincludes=org.apache.lucene  
[INFO] Scanning for projects...  
[INFO]  
[INFO] ------------------------------------------------------------------------  
[INFO] Building BoltESApplier dev  
[INFO] ------------------------------------------------------------------------  
[WARNING] The POM for com.apple.extra:ojdbc12c:jar:7.0 is missing, no dependency information available  
[WARNING] The POM for com.apple.extra:oracleucp:jar:12.1 is missing, no dependency information available  
[WARNING] The POM for com.apple.extra:boltlistener:jar:1.0 is missing, no dependency information available  
[WARNING] The POM for com.apple.extra:aqapi13:jar:1.0 is missing, no dependency information available  
[WARNING] The POM for com.apple.extra:BOLTSwitchOver-0.0.1:jar:1.0 is missing, no dependency information available  
[INFO]  
[INFO] --- maven-dependency-plugin:2.9:tree (default-cli) @ BoltESApplier ---  
[WARNING] Using Maven 2 dependency tree to get verbose output, which may be inconsistent with actual Maven 3 resolution  
[WARNING] Missing POM for com.apple.extra:ojdbc12c:jar:7.0  
[WARNING] Missing POM for com.apple.extra:oracleucp:jar:12.1  
[WARNING] Missing POM for com.apple.extra:boltlistener:jar:1.0  
[WARNING] Missing POM for com.apple.extra:aqapi13:jar:1.0  
[WARNING] Missing POM for com.apple.extra:BOLTSwitchOver-0.0.1:jar:1.0  
[INFO] applier:BoltESApplier:jar:dev  
[INFO] - org.elasticsearch:elasticsearch:jar:5.6.9:compile  
[INFO] +- org.apache.lucene:lucene-core:jar:6.6.1:compile  
[INFO] +- org.apache.lucene:lucene-analyzers-common:jar:6.6.1:compile  
[INFO] +- org.apache.lucene:lucene-backward-codecs:jar:6.6.1:compile  
[INFO] +- org.apache.lucene:lucene-grouping:jar:6.6.1:compile  
[INFO] +- org.apache.lucene:lucene-highlighter:jar:6.6.1:compile  
[INFO] +- org.apache.lucene:lucene-join:jar:6.6.1:compile  
[INFO] +- org.apache.lucene:lucene-memory:jar:6.6.1:compile  
[INFO] +- org.apache.lucene:lucene-misc:jar:6.6.1:compile  
[INFO] +- org.apache.lucene:lucene-queries:jar:6.6.1:compile  
[INFO] +- org.apache.lucene:lucene-queryparser:jar:6.6.1:compile  
[INFO] +- org.apache.lucene:lucene-sandbox:jar:6.6.1:compile  
[INFO] +- org.apache.lucene:lucene-spatial:jar:6.6.1:compile  
[INFO] +- org.apache.lucene:lucene-spatial-extras:jar:6.6.1:compile  
[INFO] +- org.apache.lucene:lucene-spatial3d:jar:6.6.1:compile  
[INFO] - org.apache.lucene:lucene-suggest:jar:6.6.1:compile  
[INFO] ------------------------------------------------------------------------  
[INFO] BUILD SUCCESS  
[INFO] ------------------------------------------------------------------------  
[INFO] Total time: 1.757 s  
[INFO] Finished at: 2018-06-01T06:06:10-07:00  
[INFO] Final Memory: 18M/443M  
[INFO] ------------------------------------------------------------------------

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 1, 2018, 5:25pm UTC](https://discuss.elastic.co/t/migration-to-rest-client-nosuchfielderror-lucene-5-5-4-error/134217/5 "2018-06-01T17:25:28Z")

</div>

Please format your code, logs or configuration files using `</>` icon as explained in [this guide](https://discuss.elastic.co/t/about-the-elasticsearch-category/21) and not the citation button. It will make your post more readable.

Or use markdown style like:

````
```
CODE
```

````

This is the icon to use if you are not using markdown format:

![image](https://us1.discourse-cdn.com/elastic/original/3X/7/e/7e6e239431ec2d71cbf1beef741f2e93e7cc762c.jpg)

There's a live preview panel for exactly this reasons.

Lots of people read these forums, and many of them will simply skip over a post that is difficult to read, because it's just too large an investment of their time to try and follow a wall of badly formatted text.

You probably have somewhere in your classpath an old version of Lucene. Or when you launch your main class, it is missing the dependencies?

---

<div class="post-metadata">

**Author:** ![Neha\_goswami](https://avatars.discourse-cdn.com/v4/letter/n/f475e1/32.png) [@Neha\_goswami](https://discuss.elastic.co/u/Neha_goswami)\
**Post date:** [June 1, 2018, 6:45pm UTC](https://discuss.elastic.co/t/migration-to-rest-client-nosuchfielderror-lucene-5-5-4-error/134217/6 "2018-06-01T18:45:20Z")

</div>

> [@Neha\_goswami](#):
>
> mvn dependency:tree -Dverbose -Dincludes=org.apache.lucene

```
when i do "mvn dependency:tree -Dverbose -Dincludes=org.apache.lucene" (output pasted in previou message) , 

```

I see lucene core jar 6.6.1 version being used.  
Actually in this project i am pulling data from kafka to elasticsearch.  
No other lucene dependency is declared in pom.xml.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 1, 2018, 7:05pm UTC](https://discuss.elastic.co/t/migration-to-rest-client-nosuchfielderror-lucene-5-5-4-error/134217/7 "2018-06-01T19:05:20Z")

</div>

As you can see this field exist in the JAR: [https://lucene.apache.org/core/6\_6\_1/core/org/apache/lucene/util/Version.html#LUCENE\_5\_4\_0](https://lucene.apache.org/core/6_6_1/core/org/apache/lucene/util/Version.html#LUCENE_5_4_0)

Which means that you have not this dependency at runtime when you execute your method or another older jar is defined before the 6.6.1 in the classpath. You need to double check what you are doing. Specifically, how do you run your code?

---

<div class="post-metadata">

**Author:** ![Neha\_goswami](https://avatars.discourse-cdn.com/v4/letter/n/f475e1/32.png) [@Neha\_goswami](https://discuss.elastic.co/u/Neha_goswami)\
**Post date:** [June 4, 2018, 5:04am UTC](https://discuss.elastic.co/t/migration-to-rest-client-nosuchfielderror-lucene-5-5-4-error/134217/8 "2018-06-04T05:04:19Z")

</div>

I was running in main class, where i was getting this lucene error.

I created a fresh project , copied same pom & code to that new project & the lucene error got resolved.  
I was able to use highlevelRestclient.

But now when i run as jar using ( **java -jar** )  
i get below error:

```
$ java -jar dev-0.0.1-SNAPSHOT.jar 
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.SecurityException: Invalid signature file digest for Manifest main attributes
	at sun.security.util.SignatureFileVerifier.processImpl(SignatureFileVerifier.java:330)
	at sun.security.util.SignatureFileVerifier.process(SignatureFileVerifier.java:263)
	at java.util.jar.JarVerifier.processEntry(JarVerifier.java:318)
	at java.util.jar.JarVerifier.update(JarVerifier.java:230)
	at java.util.jar.JarFile.initializeVerifier(JarFile.java:383)
	at java.util.jar.JarFile.getInputStream(JarFile.java:450)
	at sun.misc.URLClassPath$JarLoader$2.getInputStream(URLClassPath.java:977)
	at sun.misc.Resource.cachedInputStream(Resource.java:77)
	at sun.misc.Resource.getByteBuffer(Resource.java:160)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:454)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:495)
```

---

<div class="post-metadata">

**Author:** ![Neha\_goswami](https://avatars.discourse-cdn.com/v4/letter/n/f475e1/32.png) [@Neha\_goswami](https://discuss.elastic.co/u/Neha_goswami)\
**Post date:** [June 4, 2018, 5:05am UTC](https://discuss.elastic.co/t/migration-to-rest-client-nosuchfielderror-lucene-5-5-4-error/134217/9 "2018-06-04T05:05:20Z")

</div>

I get this error **ONLY when i add this dependency in my pom** ::

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

---

<div class="post-metadata">

**Author:** ![Neha\_goswami](https://avatars.discourse-cdn.com/v4/letter/n/f475e1/32.png) [@Neha\_goswami](https://discuss.elastic.co/u/Neha_goswami)\
**Post date:** [June 4, 2018, 5:56am UTC](https://discuss.elastic.co/t/migration-to-rest-client-nosuchfielderror-lucene-5-5-4-error/134217/10 "2018-06-04T05:56:04Z")

</div>

This is due to maven shade plugin

Resolved this by adding below to pom.xml

```
    	<configuration>
								<filters>
									<filter>
										<artifact>*:*</artifact>
										<excludes>
											<exclude>META-INF/*.SF</exclude>
											<exclude>META-INF/*.DSA</exclude>
											<exclude>META-INF/*.RSA</exclude>
										</excludes>
									</filter>
								</filters>
```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 2, 2018, 5:56am UTC](https://discuss.elastic.co/t/migration-to-rest-client-nosuchfielderror-lucene-5-5-4-error/134217/11 "2018-07-02T05:56:10Z")

</div>

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