10

This causes error 'A SPI class of type lucene.codecs.Codec name' Lucene42 '

 3 years ago
source link: https://www.codesd.com/item/this-causes-error-a-spi-class-of-type-lucene-codecs-codec-name-lucene42.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

This causes error 'A SPI class of type lucene.codecs.Codec name' Lucene42 '

advertisements

Can't figure out what is causing ' 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'

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

6DS0K.png

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 build 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" />


I find something about this. Hope there would be helpful though I use lucene 4.10.2.

The codecs are configured in 'org.apache.lucene.codecs.Codec'. I looked into 'lucene-core-4.10.2.jar' and there is such a file 'META-INF\services\org.apache.lucene.codecs.Codec'. So you can put the class name into configuration file and lucene would find it. However, you don't need extract the jar file, add it and re-package the jar. Just create a new file with the same directory structure, that is, 'META-INF\services\org.apache.lucene.codecs.Codec' into java's classpath, e.g., 'target/classes' directory, and java would find all codec configuration file and load them.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK