[hibernate-dev] NotYetReadyException with extended bean manager

Benjamin Confino BENJAMIC at uk.ibm.com
Tue Jul 2 06:57:52 EDT 2019


Thank you for your suggestions. 

I think it's unlikely that we're passing in a null bean manager, but the 
suggestion about calling them in the proper order sounds like it could be 
the answer, so I will try that first. Hopefully that will resolve the 
matter. 

Regards
Benjamin



From:   Yoann Rodiere <yoann at hibernate.org>
To:     Benjamin Confino <BENJAMIC at uk.ibm.com>
Cc:     Hibernate Dev <hibernate-dev at lists.jboss.org>
Date:   02/07/2019 07:26
Subject:        Re: [hibernate-dev] NotYetReadyException with extended 
bean manager



Hello,

> what happens between 
ExtendedBeanManagerSynchronizer.beanManagerInitialized and 
ContainerManagedLifecycleStrategy$BeanImpl.resolveContainerInstance to 
result in this error?

Judging from your stack trace, it seems an instance of 
org.hibernate.resource.beans.container.internal.ContainerManagedLifecycleStrategy.BeanImpl 
was passed a null BeanManager.
The only place we create an instance of BeanImpl relies on 
org.hibernate.resource.beans.container.internal.CdiBasedBeanContainer#getUsableBeanManager 
to retrieve the bean manager.
When using an extended bean manager, this method should only return null 
in a very specific case and, as far as I can tell, only if you passed a 
null entityManager to 
org.hibernate.resource.beans.container.internal.CdiBeanContainerExtendedAccessImpl#beanManagerInitialized.
In any case, there's something that was not properly initialized in the 
CdiBasedBeanContainer.

Since this only happens when Hibernate Search is initialized, it is 
possible that the ExtendedBeanManager's LifecycleListeners were called out 
of order? I.e. Hibernate Search's listener was called before Hibernate 
ORM's, leading to Hibernate Search starting to initialize before Hibernate 
ORM had a chance to set the entity manager. Make sure you call the 
lifecycle listeners in the order they were passed to 
org.hibernate.resource.beans.container.spi.ExtendedBeanManager#registerLifecycleListener.

If that doesn't solve the problem, I think we'll need a reproducer to 
investigate.


Yoann Rodière
Hibernate NoORM Team
yoann at hibernate.org


On Mon, 1 Jul 2019 at 23:49, Benjamin Confino <BENJAMIC at uk.ibm.com> wrote:
Hello

I have a stack, see the attached file, where there is a 
NotYetReadyException. This is after liberty invokes 
ExtendedBeanManagerSynchronizer.beanManagerInitialized, and we are passing 

in a bean manager to hibernate. 

My question is what happens between 
ExtendedBeanManagerSynchronizer.beanManagerInitialized and 
ContainerManagedLifecycleStrategy$BeanImpl.resolveContainerInstance to 
result in this error? Is it still using the same BeanManager we passed in 
- and if so what could cause a NotYetReadyException when a bean manager is 

there? Or does hibernate try to acquire a second bean manager? If so what 
method does hibernate use to acquire the bean manager?

Regards
Benjamin



Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 
741598. 
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
_______________________________________________
hibernate-dev mailing list
hibernate-dev at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev


Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 
741598. 
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU


More information about the hibernate-dev mailing list