Hibernate search 7.1.1.Final requiring codec Lucene87?

Hi all. I have a very simple setup with reasonably recent versions of Spring, Hibernate ORM and Hibernate search in my project. Yet, when an indexed entity is created/updated, outbox events never transition from PENDING to anything else but ABORTED, because something in Hsearch is looking for a codec Lucene87.

Caused by: java.lang.IllegalArgumentException: An SPI class of type org.apache.lucene.codecs.Codec with name 'Lucene87' does not exist. You need to add the corresponding JAR file supporting this SPI to your classpath. The current classpath supports the following names: [Lucene99]

Relevant parts of my current POM look like this:

             <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>3.3.0</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.hibernate.search</groupId>
                <artifactId>hibernate-search-mapper-orm</artifactId>
                <version>7.1.1.Final</version>
            </dependency>
            <dependency>
                <groupId>org.hibernate.search</groupId>
                <artifactId>hibernate-search-backend-lucene</artifactId>
                <version>7.1.1.Final</version>
            </dependency>
            <dependency>
                <groupId>org.hibernate.search</groupId>
                <artifactId>hibernate-search-mapper-orm-outbox-polling</artifactId>
                <version>7.1.1.Final</version>
            </dependency>

I have looked into all parent POMs and none of them mention Hibernate search version 8.7.X, which presumably should require such a codec, all of those dependencies are on version 9.9.X.

I have tried to include these as a solution:

            <dependency>
                <groupId>org.apache.lucene</groupId>
                <artifactId>lucene-backward-codecs</artifactId>
                <version>9.11.1</version>
            </dependency>
            <dependency>
                <groupId>org.apache.lucene</groupId>
                <artifactId>lucene-codecs</artifactId>
                <version>8.7.0</version>
            </dependency>

To no avail. What am I missing here?

Hey @jozefmorvay_rbi

You don’t need to mix the codecs. Hibernate Search 7.1.1.Final is based on Lucene 9.9.2.

The error you mention comes from Lucene when it tries to load a codec. That can happen if your app points to an existing index created with the older version of Lucene. Try starting your app with a clean index. If that resolves the startup error, then just rebuild your index with the new version of Hibernate Search, e.g. using a mass indexer.

related SO topic: java - Hibernate search outbound polling not creating its tables - Stack Overflow

Thanks for the reply, but this happens on localhost - there are no entries in any tables or indexes built, it always starts clean. The index is only stored in memory as far as I know for the duration of the application run, so there should be nothing to rebuild when you stop it and then start it again.

hmm I see…

any chance you can create a reproducer using this template hibernate-test-case-templates/search/hibernate-search-7/orm-lucene at main · hibernate/hibernate-test-case-templates · GitHub displaying the issue? Or if not the template then a very simple app. At this point, without a reproducer, it is more of a guesswork than identifying what really causes a problem :smiley: