# ElasticSearc and Lucene compatibility issues

**URL:** <https://discuss.elastic.co/t/elasticsearc-and-lucene-compatibility-issues/118204>\
**Category:** Elasticsearch\
**Created:** [February 2, 2018, 10:03am UTC](https://discuss.elastic.co/t/elasticsearc-and-lucene-compatibility-issues/118204 "2018-02-02T10:03:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ashuspeed](https://avatars.discourse-cdn.com/v4/letter/a/ce73a5/32.png) [@ashuspeed](https://discuss.elastic.co/u/ashuspeed)\
**Post date:** [February 2, 2018, 10:03am UTC](https://discuss.elastic.co/t/elasticsearc-and-lucene-compatibility-issues/118204/1 "2018-02-02T10:03:32Z")

</div>

Hello,  
I am using **ElasticSearch 5.6.3** version as well as **Lucene version 6.6.1** in one of my projects. While trying to run the application for the first time, I am getting the following exception

```
An SPI class of type org.apache.lucene.codecs.PostingsFormat with
 classname org.apache.lucene.search.suggest.document.Completion50PostingsFormat does not exist, please fix the file 'MET
A-INF/services/org.apache.lucene.codecs.PostingsFormat' in your classpath. The specific sequence of files included or pr
ocessed is: Z:\cfusion\wwwroot\learncfinaweek\3104058\pos\bug.cfm, line: 40
Feb 01, 2018 6:16:43 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [CfmServlet] in context with path [] threw exception [Servlet execution threw an e
xception] with root cause
java.util.ServiceConfigurationError: An SPI class of type org.apache.lucene.codecs.PostingsFormat with classname org.apa
che.lucene.search.suggest.document.Completion50PostingsFormat does not exist, please fix the file 'META-INF/services/org
.apache.lucene.codecs.PostingsFormat' in your classpath.
        at org.apache.lucene.util.SPIClassIterator.next(SPIClassIterator.java:160)
        at org.apache.lucene.util.NamedSPILoader.reload(NamedSPILoader.java:70)
        at org.apache.lucene.util.NamedSPILoader.<init>(NamedSPILoader.java:51)
        at org.apache.lucene.util.NamedSPILoader.<init>(NamedSPILoader.java:38)
        at org.apache.lucene.codecs.PostingsFormat$Holder.<clinit>(PostingsFormat.java:49)
        at org.apache.lucene.codecs.PostingsFormat.forName(PostingsFormat.java:112)
        at org.apache.lucene.codecs.lucene50.Lucene50Codec.<init>(Lucene50Codec.java:161)
        at org.apache.lucene.codecs.lucene50.Lucene50Codec.<init>(Lucene50Codec.java:76)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
        at java.lang.Class.newInstance(Class.java:442)
        at org.apache.lucene.util.NamedSPILoader.reload(NamedSPILoader.java:72)
        at org.apache.lucene.util.NamedSPILoader.<init>(NamedSPILoader.java:51)
        at org.apache.lucene.util.NamedSPILoader.<init>(NamedSPILoader.java:38)
        at org.apache.lucene.codecs.Codec$Holder.<clinit>(Codec.java:47)
        at org.apache.lucene.codecs.Codec.getDefault(Codec.java:143)
        at org.apache.lucene.index.LiveIndexWriterConfig.<init>(LiveIndexWriterConfig.java:121)
        at org.apache.lucene.index.IndexWriterConfig.<init>(IndexWriterConfig.java:151)

```

Second time execution of the same application gives the following exception

```
java.lang.NoClassDefFoundError: Could not initialize class org.apache.lucene.codecs.Codec$Holder
    at org.apache.lucene.codecs.Codec.getDefault(Codec.java:143)
    at org.apache.lucene.index.LiveIndexWriterConfig.<init>(LiveIndexWriterConfig.java:121)
    at org.apache.lucene.index.IndexWriterConfig.<init>(IndexWriterConfig.java:151)

```

I have gone through many posts on Stack Overflow, but none of them seems to work out. I am using Ant as the build tool to build my project.

Can some-one please help me out on how to resolve this?

---

<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:** [February 2, 2018, 2:14pm UTC](https://discuss.elastic.co/t/elasticsearc-and-lucene-compatibility-issues/118204/2 "2018-02-02T14:14:27Z")

</div>

Most likely you have a conflict or you are repackaging some jars or something like this.

Could you describe a bit more what you are doing?  
Are you trying to embed elasticsearch?  
Are you trying to use a client? Which one?

BTW why not using something like Gradle or Maven to manage your dependencies?

---

<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:** [March 2, 2018, 2:14pm UTC](https://discuss.elastic.co/t/elasticsearc-and-lucene-compatibility-issues/118204/3 "2018-03-02T14:14:34Z")

</div>

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