0

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

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();

I have:

  • IntelliJ IDEA 2019.3.1 (Community Edition)
  • Build #IC-193.5662.53, built on December 18, 2019
  • Runtime version: 11-ea+121 amd64
  • VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
  • Linux 4.15.0-74-generic
  • GC: ParNew, ConcurrentMarkSweep
  • Memory: 1204M
  • Cores: 6

Registry:

  • Non-Bundled Plugins: DBN, Lombook Plugin, 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.

enter image description here

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.

Edit 1

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.

Edit 2

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.

1 Answers1

0

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