java.lang.ClassNotFoundException: org.hibernate.MultiTenancyStrategy

I am upgrading to hibernate 6 with spring 5.
Following dependencies I have added:

implementation (group: ‘’, name: ‘hibernate-search-mapper-orm-jakarta’, version: ‘6.1.7.Final’){
exclude group: ‘’ , module: ‘hibernate-search-engine’
exclude group: ‘org.hibernate’, module: ‘hibernate-core-jakarta’
exclude group: ‘org.hibernate.common’, module: ‘hibernate-commons-annotations’

implementation (group: ‘’, name: ‘hibernate-search-backend-lucene’, version: ‘6.1.7.Final’){
exclude group: ‘’ , module: ‘hibernate-search-engine’

implementation group: ‘org.hibernate.orm’, name: ‘hibernate-core’, version: ‘6.1.4.Final’

implementation (group: ‘org.springframework.boot’, name: ‘spring-boot-starter-data-jpa’, version: ‘2.7.3’)
exclude group: ‘org.hibernate’, module: ‘hibernate-core’
exclude group: ‘jakarta.persistence’ , module: ‘jakarta.persistence-api’
exclude group: ‘org.springframework’, module: ‘spring-tx’


Now when I run the code it gives me the below-mentioned error:

Caused by: java.lang.NoClassDefFoundError: org/hibernate/MultiTenancyStrategy
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(
	at java.base/java.util.concurrent.CompletableFuture.postComplete(
	at java.base/java.util.concurrent.CompletableFuture.complete(
	at org.hibernate.internal.SessionFactoryObserverChain.sessionFactoryCreated(
	at org.hibernate.internal.SessionFactoryImpl.<init>(
	at org.hibernate.cfg.Configuration.buildSessionFactory(
	at org.hibernate.cfg.Configuration.buildSessionFactory(
	at org.springframework.orm.hibernate5.LocalSessionFactoryBean.buildSessionFactory(
	at org.springframework.orm.hibernate5.LocalSessionFactoryBean.afterPropertiesSet(
	... 12 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.hibernate.MultiTenancyStrategy
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(
	at java.base/java.lang.ClassLoader.loadClass(
	... 29 common frames omitted

HibernateOrmMappingInitiator class is coming from hibernate-search-mapper-orm-jakarta-6.1.7.Final.jar. In this class, there is one import “org.hibernate.MultiTenancyStrategy” which is available in hibernate-core-5.6.12.Final.jar. But we have migrated to hibernate-core 6.1.4.Final. Also, the class for which I am getting error is available in hibernate-search-backend-lucene-6.1.7.Final.jar, having package name as “”.

Can anyone suggest why hibernate 6 jar is searching for an import that is available in hibernate 5, or why a wrong import is there in hibernate 6 jar.

For using Hibernate Search with Hibernate 6, you need to use special artifacts. Consult the project page: 6.1 series - Hibernate Search

Also, Spring 5 is not compatible with Hibernate 6. You need to use Spring 6.

But the question is simpler than that.The enum MultiTenancyStrategy seems to be missing from hibernate 6.

See hibernate-orm/migration-guide.adoc at 6.0 · hibernate/hibernate-orm · GitHub