[hibernate-dev] NotYetReadyException with extended bean manager

Yoann Rodiere yoann at hibernate.org
Tue Jul 2 02:26:13 EDT 2019


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


More information about the hibernate-dev mailing list