-
-
Notifications
You must be signed in to change notification settings - Fork 75
Class org.hibernate.internal.SessionImpl does not implement the requested interface jakarta.persistence.EntityManager #952
Comments
@anil-subudhi If you remove the following does it resolve the NoClassDefFoundError?
I am going to work on the hibernate-core exclude on #951 |
@jamesfredley Sorry for the late reply If I remove exclude ehcache from hibernate5, the SingletonEhcacheRegionFactory issue resolves but it throws Caused by: java.lang.IncompatibleClassChangeError: Class org.hibernate.internal.SessionImpl does not implement the requested interface jakarta.persistence.EntityManager as hibernate-ehcache includes hibernate-core:5.6.15 and org.hibernate.internal.SessionImpl not present in 5.6.15 version
Explicitly adding hibernate-ehcache like doesn't resolve SingletonEhcacheRegionFactory
|
That is surprising! For testing purposes, could you try: implementation 'org.grails.plugins:hibernate5:9.0.0-M2', {
exclude group: 'org.hibernate', module: 'hibernate-ehcache'
}
runtimeOnly 'org.hibernate:hibernate-ehcache:5.6.15.Final', {
// exclude javax variant of hibernate-core 5.6
exclude group: 'org.hibernate', module: 'hibernate-core'
}
runtimeOnly 'org.jboss.spec.javax.transaction:jboss-transaction-api_1.3_spec:2.0.0.Final', {
// required for hibernate-ehcache to work with javax variant of hibernate-core excluded
} |
Thank you @matrei for quick reply,
Resolves the SingletonEhcacheRegionFactory, without jboss-transaction-api_1.3_spec it throws NoClassDefFoundError
|
OK @anil-subudhi, thanks for the confirmation! |
Hibernate dependencies:
grails-datastore-gorm-hibernate5-9.0.0-M2.jar
hibernate-commons-annotations-5.1.2.Final.jar
hibernate-core-5.6.15.Final.jar
hibernate-core-jakarta-5.6.15.Final.jar
hibernate-ehcache-5.6.15.Final.jar
hibernate-validator-8.0.2.Final.jar
hibernate5-9.0.0-M2.jar
Dependency tree of hibernate-echache
org.hibernate.internal.SessionImpl present in hibernate-core 5.6.15.Final doesn't implement jakarta.persistence.EntityManager
https://github.com/hibernate/hibernate-orm/blob/5.6/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java
Error:
Steps I checked,
excluded default hibernate-ehcache included explicitly and excluded hibernate-core
Now the hibernate dependencies
grails-datastore-gorm-hibernate5-9.0.0-M2.jar
hibernate-commons-annotations-5.1.2.Final.jar
hibernate-core-jakarta-5.6.15.Final.jar
hibernate-ehcache-5.6.15.Final.jar
hibernate-validator-8.0.2.Final.jar
hibernate5-9.0.0-M2.jar
Starting application without hibernate-core throws below error
SingletonEhcacheRegionFactory not present in hibernate-core-jakarta
Including hibernate-core higher version hibernate-core-6.6.4.Final.jar which has jakarta.persistence.EntityManager implementation throws below error
implementation group: 'org.hibernate.orm', name: 'hibernate-core', version: '6.6.4.Final'
https://github.com/hibernate/hibernate-orm/blob/6.6/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.cache.ehcache.internal.SingletonEhcacheRegionFactory
It is only available upto hibernate-core-5.6
https://github.com/hibernate/hibernate-orm/blob/5.6/hibernate-ehcache/src/main/java/org/hibernate/cache/ehcache/internal/SingletonEhcacheRegionFactory.java
The text was updated successfully, but these errors were encountered: