Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

An SPI class of type org.apache.lucene.codecs.Codec with name 'Lucene54' does not exist

Tags:

java

lucene

spi

With lucene-core-5.5.2 i am facing problem a in weblogic server. standalone search application works but when i deploy as WEB APP it is failing with below error

Exception type is 'java.lang.ExceptionInInitializerError'. Runtime error: java.lang.IllegalArgumentException: An SPI class of type org.apache.lucene.codecs.Codec with name 'Lucene54' does not exist. You need to add the corresponding JAR file supporting this SPI to your classpath. The current classpath supports the following names: []

I tried creating folder structure under classes/ as META-INF/services/ added all files from lucene-core-5.5.2.jar META-INF\services\ directory also created jar file for META-INF\services\ and added in classpath but it doesn't recognize META-INF/services to load SPI

Any help would be really appreciated.

like image 601
Amol Avatar asked Jul 13 '16 20:07

Amol


2 Answers

Please add following file in

Folder : META-INF/services/

File :org.apache.lucene.codecs.Codec

Text :org.apache.lucene.codecs.lucene54.Lucene54Codec

Please review the solution with detailed description at https://anwaarlabs.wordpress.com/2017/02/25/lucene-an-spi-class-of-type-org-apache-lucene-codecs-codec-with-name-does-not-exist/

like image 163
Digital Alchemist Avatar answered Sep 17 '22 12:09

Digital Alchemist


I got this building with gradle using a proposed solution to build a "fat jar" (executable jar containing all dependent jars) here.

But it didn't work: I got this obscure error to do with Lucene, but not when testing or building or running normally, only when building a fat jar.

My solution was to use shadow jar: code from gradle.build:

buildscript {
    repositories { jcenter() }
    dependencies { // fatjar
        classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.4' }
}
apply plugin: 'com.github.johnrengelman.shadow'
shadowJar {
    baseName = project.name
    classifier = null
    version = project.version
}
like image 28
mike rodent Avatar answered Sep 20 '22 12:09

mike rodent