4 Replies Latest reply on Jun 18, 2010 9:05 AM by Pete Muir

    Unexpected behaviour when binding to java:comp and @Startup beans

    Marius Bogoevici Expert

      So, for Weld-int  we bind a BeanManager to java:comp/BeanManager. In order to make it accessible to EJBs, the binding procedure works like this:

       

      1) Obtain the JavaEEComponent which corresponds to the EJBs DU

      2) From the JavaEEComponent, obtain the Context (which represents java:comp for said component)

      3) Bind the BeanManager

      As a bit of background, one of the interceptors that are applied to CDI-enabled EJBs is injected with a @Resource("java:comp/BeanManager")

       

       

      This works fine, as long as the EJB is not a @Startup  bean. For the latter, the lookup that is performed during EJBContainer.startup() seems to miss the JavaEEComponent (debugging ComponentObjectFactory shows that CurrentComponent.get() returns null and thus JavaEEComponent is ignored - so that the BeanManager that is bound to JavaEEComponent's context is not found).

       

      So, I'm looking forward to some clarifications concerning this - mainly to discuss what's the best way to move forward:

       

      a) open a JIRA, fix the issue, or

      b) use the SwitchBoard

       

      Thanks,

      Marius

       

      Message was edited by: Marius Bogoevici, typo in title