本文介绍了导致错误的原因'lucene.codecs类型的SPI类.编解码器名称为'Lucene42'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

无法弄清是什么原因导致的.名称为"Lucene42"的org.apache.lucene.codecs.Codec类型的SPI类不存在.您需要将支持此SPI的相应JAR文件添加到类路径中

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'

任何帮助将不胜感激

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部署文件夹路径'C:\ JBAS \ modules \ org \ apache \ lucene \ main'和目录内容

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

jboss-deployment-structure.xml

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.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构建文件段

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

推荐答案

请在以下文件中添加

文件夹:META-INF/services/

文件:org.apache.lucene.codecs.Codec

文本:org.apache.lucene.codecs.lucene54.Lucene54Codec

请在"> https://anwaarlabs.wordpress.com/2017/02/25/lucene-an-spi-class-of-type- org-apache-lucene-codecs-codec-with-name-does-不存在/

此解决方案是为Lucene5.4定义的,也适用于Lucene 4.2.谢谢

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

这篇关于导致错误的原因'lucene.codecs类型的SPI类.编解码器名称为'Lucene42'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-27 08:48