简体   繁体   English

名为“Lucene54”的类型为org.apache.lucene.codecs.Codec的SPI类不存在

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

With lucene-core-5.5.2 i am facing problem a in weblogic server. 使用lucene-core-5.5.2,我在weblogic服务器中遇到问题。 standalone search application works but when i deploy as WEB APP it is failing with below error 独立搜索应用程序可以工作,但是当我作为WEB APP部署时,它失败并出现以下错误

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 我尝试在classes/下创建文件夹结构,因为META-INF/services/添加了来自lucene-core-5.5.2.jar META-INF\\services\\所有文件lucene-core-5.5.2.jar META-INF\\services\\目录也创建了META-INF\\services\\ jar文件并添加到类路径中但它无法识别加载SPI的META-INF/services

Any help would be really appreciated. 任何帮助将非常感激。

Please add following file in 请添加以下文件

Folder : META-INF/services/ 文件夹: META-INF/services/

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

Text : org.apache.lucene.codecs.lucene54.Lucene54Codec 文字: 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/ 请查看解决方案,详细说明请访问https://anwaarlabs.wordpress.com/2017/02/25/lucene-an-spi-class-of-type-org-apache-lucene-codecs-codec-with-name-不存在/

its is fixed i added lucene jars in weblogic app server classpath and it is working as expected. 它是固定的我在weblogic app server classpath中添加了lucene jar并且它按预期工作。 i dont know why it is not detecting from my applications lib folder as its also on class path but looks like somehow SPI needs jars and META-INF on app servers classpath 我不知道为什么它不是从我的应用程序li​​b文件夹中检测到它也在类路径上,但看起来像某种程度上SPI需要jar和appA服务器类路径上的META-INF

I got this building with gradle using a proposed solution to build a "fat jar" (executable jar containing all dependent jars) here . 我用一个提出的解决方案,以建立一个“胖罐子”(包含所有依赖jar可执行的JAR)得到这个建筑gradle这个位置

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. 但它不起作用:我得到了与Lucene一样的模糊错误,但是在测试或构建或正常运行时,仅在构建胖罐时没有。

My solution was to use shadow jar : code from gradle.build: 我的解决方案是使用shadow jar :来自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
}

I added the below code into configuration tags 我将以下代码添加到配置标记中

        <transformers>
    <transformer  implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                  <resource>META-INF/services/org.apache.lucene.codecs.Codec</resource>
                  <resource>META-INF/services/org.apache.lucene.codecs.PostingsFormat</resource>
     /transformer>
         </transformers>

And also I add lucene-core dependency at the top of the dependencies tag 此外,我还在依赖项标记的顶部添加了lucene-core依赖项

                    <dependency>
                        <groupId>org.apache.lucene</groupId>
                        <artifactId>lucene-core</artifactId>
                        <version>5.5.0</version>
                     </dependency>

Make sure that the lucene jar that you have included in your project is of the same version as that of lucene codec mentioned in error. 确保项目中包含的lucene jar与错误中提到的lucene编解码器的版本相同。 Eg if the error states LuceneCodec62 then you should have lucene-6.xx jar included in your project. 例如,如果错误表明LuceneCodec62,那么你的项目中应该包含lucene-6.xx jar。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 异常:java.lang.IllegalArgumentException:名称为“Lucene410”的 org.apache.lucene.codecs.Codec 类型的 SPI 类不存在 - Exception : java.lang.IllegalArgumentException: An SPI class of type org.apache.lucene.codecs.Codec with name 'Lucene410' does not exist sbt-assembly 和 Lucene “不存在名称为‘Lucene94’的 org.apache.lucene.codecs.Codec 类型的 SPI 类。”异常 - sbt-assembly and Lucene "An SPI class of type org.apache.lucene.codecs.Codec with name 'Lucene94' does not exist.¨ exception 名称为“Memory”的 org.apache.lucene.codecs.DocValuesFormat 类型的 SPI class 不存在 - An SPI class of type org.apache.lucene.codecs.DocValuesFormat with name 'Memory' does not exist 是什么导致错误&#39;类型为lucene.codecs.Codec的SPI类&#39;Lucene42&#39; - What causes err ' A SPI class of type lucene.codecs.Codec name 'Lucene42' java.lang.NoClassDefFoundError:org / apache / lucene / codecs / Codec - java.lang.NoClassDefFoundError: org/apache/lucene/codecs/Codec ServiceConfigurationError:无法实例化 SPI class:org.apache.lucene.codecs.compressing.FastCompressingCodec - ServiceConfigurationError: Cannot instantiate SPI class: org.apache.lucene.codecs.compressing.FastCompressingCodec 从源代码构建lucene:编解码器不存在 - Build lucene from sources: Codec does not exist java.lang.NoClassDefFoundError:org / apache / lucene / codecs / simpletext / SimpleTextCodec - java.lang.NoClassDefFoundError: org/apache/lucene/codecs/simpletext/SimpleTextCodec Lucene的org.apache.lucene.document.Field类的方法使用 - Methods usage of org.apache.lucene.document.Field class of Lucene Maven打包失败Lucene,SPI不存在异常 - Maven packaging fail Lucene, SPI does not exist Exception
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM