Skip to main content

inject request scoped cdi bean in singleton startup ejb

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
No replies
waloszek
Offline
Joined: 2006-02-14

Hello,

when I try to inject a request scoped cdi bean into a singleton startup ejb I get a ContextNotActiveException. I am not sure if this is a bug or if this is not supported. The specification says that request scope is active ...

"during any remote method invocation of any EJB, during any asynchronous method invocation of any EJB, during any call to an EJB timeout method and during message delivery to any EJB message-driven bean, and ... "

Our architecture uses a lot of ApplicationScoped Services that use RequestScoped EntityManager to make sure that the EntityManager is used in a thread safe way. Unfortunately I can not use all our services when my entry point is the singleton startup ejb.

Does anyone have a suggestion or opinion concerning the problem above.

Best regards
André