gpt4 book ai didi

java - 异常 : java. lang.IllegalArgumentException : An SPI class of type org. 名称为 'Lucene410' 的 apache.lucene.codecs.Codec 不存在

转载 作者:行者123 更新时间:2023-12-01 18:51:25 27 4
gpt4 key购买 nike

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

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

    ... 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 库的依赖显然没有包含在项目中。然而,在几个地方有一个到它的类的直接链接:

    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
  • 虚拟机:JetBrains s.r.o 提供的 OpenJDK 64 位服务器虚拟机
  • Linux 4.15.0-74-通用
  • GC:ParNew、ConcurrentMarkSweep
  • 内存:1204M
  • 核心:6

注册表:

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

该库的一个版本在项目树中可见。不仅仅是核心。

enter image description here

按照建议,将“org.apache.lucene.codecs.Codec”文件添加到项目中 here , herehere ,在向模块的 build.gradle 添加显式依赖项(由于某种原因未出现在外部库树中)时,不会给出任何内容。

编辑 1

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

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

如果用旧版本替换新版本,问题就会消失:

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

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

编辑2

仅在库版本“5.5.8.Final”(含)之前不会引发此异常。并且,版本“5.6.6.Final”及更高版本中的任何内容都不再出现。

最佳答案

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

关于java - 异常 : java. lang.IllegalArgumentException : An SPI class of type org. 名称为 'Lucene410' 的 apache.lucene.codecs.Codec 不存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59733239/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com