ElasticSearc and Lucene compatibility issues


(Ashu) #1

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?


(David Pilato) #2

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?


(system) #3

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