I am facing an issue while upgrading my BAS application from Java 8 to Java 17.
I have also upgraded hibernate from 5.3.29.Final to 6.5.0.final
I am using OpenLiberty version 24.0.0.4 with this configurations in my server.xml
<feature>cdi-4.0</feature>
<feature>jakartaee-10.0</feature>
<feature>persistence-3.1</feature>
<feature>microProfile-6.0</feature>
<feature>messaging-3.1</feature>
<feature>appSecurity-5.0</feature>
<feature>beanValidation-3.0</feature>
<feature>persistenceContainer-3.1</feature>
<feature>servlet-6.0</feature>
I am getting this error inside openliberty server logs
[ERROR ] CWWJP0015E: An error occurred in the org.hibernate.jpa.HibernatePersistenceProvider persistence provider when it attempted to create the container entity manager factory for the mpce persistence unit. The following error occurred: Error attempting to apply AttributeConverter: org.hibernate.resource.beans.container.internal.NotYetReadyException: CDI BeanManager not (yet) ready to use
Can anyone help me with this?
I have tried these solutions so far but nothing worked
have tried several approches to solve this issue
- By delaying Hibernate’s attempt to access CDI until it’s fully initialized. We did this by adding the following property in persistence.xml
<property name="hibernate.delay_cdi_access" value="true"/>
-
Providing the BeanManager instance directly to Hibernate
For this created a BeanManagerProvider class that provides the CDI BeanManager instance
Then added the following property in persistence.xml
<property name="hibernate.cdi.beanmanager" value="com.example.BeanManagerProvider.getBeanManager"/>
-
Checked compatibility of of Jakarta EE and CDI with Hibernate ORM 6.5.0.Final.
we are using cdi v4 , openliberty 24.0.0.4 and jakarta ee10 which are compatible with this hibernate version.
I am expecting that hibernate should initialize after the CDI bean manager is ready to use