Vedran Prišćan (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=63d101b...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiOTdiOGFmMmE2...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-16096?atlOrigin=eyJpIjoiOTdiOG...
) HHH-16096 (
https://hibernate.atlassian.net/browse/HHH-16096?atlOrigin=eyJpIjoiOTdiOG...
) Passing an ExtendedBeanManager which is notified too late leads to initialization error
(
https://hibernate.atlassian.net/browse/HHH-16096?atlOrigin=eyJpIjoiOTdiOG...
)
Issue Type: Bug Affects Versions: 6.0.0, 6.1.6 Assignee: Vedran Prišćan (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=63d101b...
) Created: 25/Jan/2023 02:54 AM Priority: Major Reporter: Vedran Prišćan (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=63d101b...
) Original estimate: 0.5h Remaining Estimate: 0.5h
Hibernate cannot be successfully initialized in the following scenario:
* ExtendedBeanManager is used and is notified too late (for example on WildFly)
* custom UserType that also implements DynamicParameterizedType is used for entity
column.
For example, JsonBinaryType from io.hypersistence.hypersistence-utils-hibernate-60 does
not work on WildFly. @Vlad Mihalcea
Cause: There is a missing null check for BeanManager in
org.hibernate.resource.beans.container.internal.JpaCompliantLifecycleStrategy.NamedBeanImpl.initialize.
Note: hibernate.query.startup_check=false and hibernate.delay_cdi_access=true do not
resolve the issue.
Stack trace when initialization fails:
mnc_standalone | Caused by:
org.hibernate.resource.beans.container.internal.NotYetReadyException: CDI BeanManager not
(yet) ready to use
mnc_standalone | at
org.hibernate(a)6.1.5.Final//org.hibernate.resource.beans.container.internal.JpaCompliantLifecycleStrategy
$NamedBeanImpl.initialize(JpaCompliantLifecycleStrategy.java:231)
mnc_standalone | at
org.hibernate(a)6.1.5.Final//org.hibernate.resource.beans.container.internal.CdiBeanContainerExtendedAccessImpl
$NamedBeanImpl.initialize(CdiBeanContainerExtendedAccessImpl.java:165)
mnc_standalone | at
org.hibernate(a)6.1.5.Final//org.hibernate.resource.beans.container.internal.CdiBeanContainerExtendedAccessImpl
$NamedBeanImpl.getBeanInstance(CdiBeanContainerExtendedAccessImpl.java:172)
mnc_standalone | at
org.hibernate(a)6.1.5.Final//org.hibernate.resource.beans.internal.ManagedBeanRegistryImpl
$ContainedBeanManagedBeanAdapter.getBeanInstance(ManagedBeanRegistryImpl.java:155)
mnc_standalone | at
org.hibernate@6.1.5.Final//org.hibernate.mapping.BasicValue.setExplicitCustomType(BasicValue.java:828)
mnc_standalone | at
org.hibernate@6.1.5.Final//org.hibernate.cfg.annotations.BasicValueBinder.fillSimpleValue(BasicValueBinder.java:1238)
mnc_standalone | at
org.hibernate@6.1.5.Final//org.hibernate.cfg.SetBasicValueTypeSecondPass.doSecondPass(SetBasicValueTypeSecondPass.java:26)
mnc_standalone | at
org.hibernate@6.1.5.Final//org.hibernate.boot.internal.InFlightMetadataCollectorImpl.processSecondPasses(InFlightMetadataCollectorImpl.java:1782)
mnc_standalone | at
org.hibernate@6.1.5.Final//org.hibernate.boot.internal.InFlightMetadataCollectorImpl.processSecondPasses(InFlightMetadataCollectorImpl.java:1729)
mnc_standalone | at
org.hibernate@6.1.5.Final//org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:300)
mnc_standalone | at
org.hibernate@6.1.5.Final//org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1350)
mnc_standalone | at
org.hibernate@6.1.5.Final//org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1421)
mnc_standalone | at
org.hibernate.jipijapa-hibernate6@27.0.1.Final//org.jboss.as.jpa.hibernate.TwoPhaseBootstrapImpl.build(TwoPhaseBootstrapImpl.java:45)
mnc_standalone | at
org.jboss.as.jpa(a)27.0.1.Final//org.jboss.as.jpa.service.PersistenceUnitServiceImpl $1
$1.run(PersistenceUnitServiceImpl.java:171)
mnc_standalone | ... 10 more
mnc_standalone | Caused by: java.lang.NullPointerException
mnc_standalone | at
org.hibernate(a)6.1.5.Final//org.hibernate.resource.beans.container.internal.JpaCompliantLifecycleStrategy
$NamedBeanImpl.initialize(JpaCompliantLifecycleStrategy.java:228)
mnc_standalone | ... 23 more
In HHH-14914 (
https://hibernate.atlassian.net/browse/HHH-14914 ) similar issue was
resolved for UserTypes that don't implement DynamicParameterizedType by adding a null
check in JpaCompliantLifecycleStrategy.BeanImpl.
Solution: add a null check for BeanManager in
org.hibernate.resource.beans.container.internal.JpaCompliantLifecycleStrategy.NamedBeanImpl.initialize
equivalent to HHH-14914 (
https://github.com/hibernate/hibernate-orm/commit/9fec060fe2c61881080b410...
) commit.
(
https://hibernate.atlassian.net/browse/HHH-16096#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16096#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100214- sha1:3d33cb1 )