异常: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

查看:263
本文介绍了异常:java.lang.IllegalArgumentException:名为"Lucene410"的org.apache.lucene.codecs.Codec类型的SPI类不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我处理一个多模块gradle项目(12个模块).我继承了该项目,并且需要更新其中使用的某些库的版本.

I work with a multi-module gradle project (12 modules). I inherited the project and I need to update the versions of some libraries used in it.

我无法理解此错误的原因:

I can’t understand the cause of this error:

    ... 67 more
Caused by: java.lang.IllegalArgumentException: An SPI class of type org.apache.lucene.codecs.Codec with name 'Lucene410' does not exist.  You need to add the corresponding JAR file supporting this SPI to your classpath.  The current classpath supports the following names: [Lucene54]
    at org.apache.lucene.util.NamedSPILoader.lookup(NamedSPILoader.java:114)
    at org.apache.lucene.codecs.Codec.forName(Codec.java:113)
    at org.apache.lucene.index.SegmentInfos.readCodec(SegmentInfos.java:469)
    ... 81 more

最初,项目中显然没有包括对Lucena库的依赖.但是,在几个地方有一个直接指向其类的链接:

Initially, the dependency on the Lucena library was clearly not included in the project. However, in a couple of places there is a direct link to its classes:

    org.apache.lucene.search.Query lQuery = queryBuilder.keyword().onFields("name", "code").matching(name).createQuery();

我有:

  • IntelliJ IDEA 2019.3.1(社区版)
  • 内部版本号#IC-193.5662.53,建于2019年12月18日
  • 运行时版本:11-ea + 121 amd64
  • VM:JetBrains s.r.o的OpenJDK 64位服务器VM
  • Linux 4.15.0-74-通用
  • GC:ParNew,ConcurrentMarkSweep
  • 内存:1204M
  • 核心数:6

注册表:

  • 非捆绑插件:DBN,Lombook插件,OdpsStudio,com.jetbrains.ChooseRuntime,marcglasberg.HibernateInspectionsPlugin,org.dnltsk.mapfileplugin,org.jetbrains.kotlin

该库的版本在项目树中可见.而不仅仅是核心.

A version of this library is visible in the project tree. And not just the core.

根据建议此处此处,在向模块的build.gradle添加显式依赖项(出于某种原因未出现在外部库树中)的同时,没有给出任何内容.

Adding the "org.apache.lucene.codecs.Codec" file to the project, as advised here, here and here, while adding an explicit dependency (which for some reason does not appear in the external library tree) to the build.gradle of module, does not give anything.

此依赖关系是从Hibernate库中检索的:

This dependency is retrieved from the Hibernate library:

compile group: 'org.hibernate', name: 'hibernate-search-orm', version: '5.11.4.Final'

如果用较旧的版本替换较新的版本,则问题消失:

If you replace a newer version with an older one, then the problem disappears:

compile group: 'org.hibernate', name: 'hibernate-search', version: '5.3.0.Final'

但是我想了解如何使用较新的版本.

But I would like to understand how to make work with a newer version.

仅在库版本"5.5.8.Final"(含)之前不会引发此异常.而且,版本"5.6.6.Final"和更高版本中的任何内容都不会再次出现.

This exception is not thrown only up to the library version "5.5.8.Final" inclusive. And, nothing from the version "5.6.6. Final" and newer, appears again.

推荐答案

如果不需要存储索引,只需删除存储索引的系统文件夹的内容即可. <property name="hibernate.search.default.indexBase" value="/var/lucene/indexes"/> 就我而言,它是/var/lucene/indexes文件夹

If you don't need care about stored indexes, you can simply delete content of the system folder where indexes are stored. <property name="hibernate.search.default.indexBase" value="/var/lucene/indexes"/> In my case it was /var/lucene/indexes folder

这篇关于异常:java.lang.IllegalArgumentException:名为"Lucene410"的org.apache.lucene.codecs.Codec类型的SPI类不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆