2

I want to use elasticsearch in my java application but when I try to connect to my Node, i had the following error

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/lucene/util/Version

So I install the lucene librairie (version 6.5.1) And I still the error. I'm a beginner with elasticsearch so please tell me if I forgot a step

Alexandre S.
  • 522
  • 2
  • 5
  • 24

1 Answers1

2

As mentioned by Mocky in this answer:

This is caused when there is a class file that your code depends on and it is present at compile time but not found at runtime. Look for differences in your build time and runtime classpaths.

So, if using maven then add,

<dependency>
   <groupId>org.apache.lucene</groupId>
   <artifactId>lucene-core</artifactId>
   <version>3.6.0</version>
</dependency>

if using gradle,

// https://mvnrepository.com/artifact/org.apache.lucene/lucene-core

compile group: 'org.apache.lucene', name: 'lucene-core', version: '3.6.0'
blackgreen
  • 34,072
  • 23
  • 111
  • 129
RoshanKumar Mutha
  • 2,235
  • 1
  • 12
  • 13
  • Im on the IDE netbeans. I already add the `lucene-core-3.6.0.jar` librairie on my project. But It still didn't work, I got this error now : `Exception in thread "main" java.lang.NoSuchFieldError: LUCENE_3_6` – Alexandre S. May 30 '17 at 12:50