Hibernate Search and Hibernate Core Compatibility Issue in Sring Boot 3

87 views Asked by At

I'm using spring boot v3.1.2 with spring-boot-starter-data-jpa

After adding the Hibernate Search dependency I got the following error

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-search-orm</artifactId>
    <version>5.8.2.Final</version>
</dependency>
***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    org.hibernate.search.cfg.impl.SearchConfigurationFromHibernateCore.<init>(SearchConfigurationFromHibernateCore.java:80)

The following method did not exist:

    'org.hibernate.MultiTenancyStrategy org.hibernate.boot.spi.SessionFactoryOptions.getMultiTenancyStrategy()'

The calling method's class, org.hibernate.search.cfg.impl.SearchConfigurationFromHibernateCore, was loaded from the following location:

    jar:file:/Users/smaillns/.m2/repository/org/hibernate/hibernate-search-orm/5.8.2.Final/hibernate-search-orm-5.8.2.Final.jar!/org/hibernate/search/cfg/impl/SearchConfigurationFromHibernateCore.class

The called method's class, org.hibernate.boot.spi.SessionFactoryOptions, is available from the following locations:

    jar:file:/Users/smaillns/.m2/repository/org/hibernate/orm/hibernate-core/6.2.6.Final/hibernate-core-6.2.6.Final.jar!/org/hibernate/boot/spi/SessionFactoryOptions.class
    jar:file:/Users/smaillns/.m2/repository/org/hibernate/hibernate-core/5.2.11.Final/hibernate-core-5.2.11.Final.jar!/org/hibernate/boot/spi/SessionFactoryOptions.class

The called method's class hierarchy was loaded from the following locations:

    org.hibernate.boot.spi.SessionFactoryOptions: file:/Users/smaillns/.m2/repository/org/hibernate/orm/hibernate-core/6.2.6.Final/hibernate-core-6.2.6.Final.jar


Action:

Correct the classpath of your application so that it contains compatible versions of the classes org.hibernate.search.cfg.impl.SearchConfigurationFromHibernateCore and org.hibernate.boot.spi.SessionFactoryOptions

1

There are 1 answers

2
samabcde On

The Hibernate ORM version from springboot-starter-jpa 3.1.2 is 6.2.6.Final. And your hibernate search version 5.8 is not compatible to Hibernate ORM 6.

By referring to Compatibility of Hibernate Search 6.2, you will need

<dependency>
    <groupId>org.hibernate.search</groupId>
    <artifactId>hibernate-search-mapper-orm-orm6</artifactId>
    <version>6.2.3.Final</version>
</dependency>

To be compatible to Hibernate ORM 6.

Since this is a major version change, you may want to refer to Hibernate search migration guide for details.