What causes err? SPI class of type lucene.codecs.Codec name 'Lucene42'

Can't figure out what is calling "An SPI class of type org.apache.lucene.codecs.Codec named" Lucene42 "does not exist. You need to add the appropriate JAR file that supports this SPI to your classpath

Any help would be appreciated

java.lang.IllegalArgumentException: A SPI class of type org.apache.lucene.codecs.Codec with name 'Lucene42' does not exist. You need to add the corresponding JAR file supporting this SPI to your classpath.The current classpath supports the following names: []
org.apache.lucene.util.NamedSPILoader.lookup(NamedSPILoader.java:104)
org.apache.lucene.codecs.Codec.forName(Codec.java:95)
org.apache.lucene.codecs.Codec.<clinit>(Codec.java:122)
org.apache.lucene.index.LiveIndexWriterConfig.<init>(LiveIndexWriterConfig.java:118)
org.apache.lucene.index.IndexWriterConfig.<init>(IndexWriterConfig.java:145)
com.damn.fr.rr.rent.getResukt(Man.java:404)
com.damn.fr.rr.handler.pg.setResult(pg.java:103)
com.damn.fr.rr.cmd.del.execute(del.java:19)
com.damn.fr.rr.servlet.PublicController.doPost(controller.java:199)
javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

      

Jboss deployment folder path 'C: \ JBAS \ modules \ org \ apache \ lucene \ main' and directory contents enter image description here

Jboss deployment-structure.xml

    <sub-deployment name="damn.jar">
    <dependencies>
        <module name="org.apache.commons.fileupload" />
        <module name="org.apache.commons.io" />
        <module name="org.apache.commons.lang3" />
        <module name="org.apache.commons.validator" />
        <module name="org.apache.lucene" />
        <module name="net.sf.jasperreports" />
        <module name="com.google.gson" />

    </dependencies>
</sub-deployment>

      

module.xml

<module xmlns="urn:jboss:module:1.0" name="org.apache.lucene">
<resources>
<resource-root path="lucene-analyzers-common-4.2.0.jar"/>
<resource-root path="lucene-core-4.2.0.jar"/>
<resource-root path="lucene-queryparser-4.2.0.jar"/>
<resource-root path="lucene-codecs-4.2.0.jar"/>
</resources>

<dependencies>
</dependencies>

      

ant assembly file segment

<pathelement path="${thirdPartyDir}/lucene-analyzers-common-4.2.0.jar" />
<pathelement path="${thirdPartyDir}/lucene-codecs-4.2.0.jar" />
<pathelement path="${thirdPartyDir}/lucene-queryparser-  4.2.0.jar" />
<pathelement path="${thirdPartyDir}/lucene-core-4.2-SNAPSHOT.jar" />

      

+3


source to share


3 answers


Add the following file to

Folder: META-INF/services/

File: org.apache.lucene.codecs.Codec



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

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

This solution is defined for Lucene5.4, it also works for Lucene 4.2. Thanks to

+2


source


I'm thinking something about it. Hope this would be helpful although I am using lucene 4.10.2.



Codecs are configured in 'org.apache.lucene.codecs.Codec'. I looked in "lucene-core-4.10.2.jar" and there is a file like "META-INF \ services \ org.apache.lucene.codecs.Codec". So you can put the class name in the config file and lucene will find it. However, you don't need to extract the jar file, add it and repack the jar. Just create a new file with the same directory structure ie "META-INF \ services \ org.apache.lucene.codecs.Codec" in java classpath like "target / classes" directory and java will find all codecs config file and download them.

+1


source


sometimes it happens when you create an index using lucene version, or your index is corrupted. try dropping the entire index and re-indexing.

0


source







All Articles