Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
4 replies Latest Post - ‏2011-03-30T02:30:34Z by denisF
denisF
denisF
12 Posts
ACCEPTED ANSWER

Pinned topic CDI: beanManager null during faces...PostConstructApplicationEvent?

‏2011-03-24T19:41:57Z |
BeanManager is null during the processing of javax.faces.event.PostConstructApplicationEvent..
The attached ear file demonstrate this.
Is there something missing in the attached ear? is it by the specs?
Updated on 2011-03-30T02:30:34Z at 2011-03-30T02:30:34Z by denisF
  • bergmark
    bergmark
    8 Posts
    ACCEPTED ANSWER

    Re: CDI: beanManager null during faces...PostConstructApplicationEvent?

    ‏2011-03-25T19:28:33Z  in response to denisF
    I do not believe that JSF SystemEventListeners are in the list of "Component classes supporting injection" in Table EE-5.1 of the Java Platform Enterprise Edition specification. That means that the class is not injected into, so the @Inject field will be null.
  • denisF
    denisF
    12 Posts
    ACCEPTED ANSWER

    Re: CDI: beanManager null during faces...PostConstructApplicationEvent?

    ‏2011-03-26T22:24:26Z  in response to denisF
    Strange because WAS emits this message in the logs...

    
    BeansDeployer I BeansDeployer validateInjectionPoints All injection points were validated successfully. WebContainerL I WebContainerLifecycle startApplication OpenWebBeans Container has started, it took [121] ms
    

    I would like to have an official answer on this as it looks like a bug
    • bergmark
      bergmark
      8 Posts
      ACCEPTED ANSWER

      Re: CDI: beanManager null during faces...PostConstructApplicationEvent?

      ‏2011-03-28T14:38:59Z  in response to denisF
      The issue is not that CDI isn't starting properly, it is that the component in question is a JSF SystemEventListener managed by the JSF contianer. As it is not in the list of component's supporting EE injection, it is not going to be called for any kind of injection (including @Inject).

      You could verify this by trying @Resource, @EJB, etc. I do not believe any of those injections will be satisfied either. This appears to be working as designed.
  • denisF
    denisF
    12 Posts
    ACCEPTED ANSWER

    Re: CDI: beanManager null during faces...PostConstructApplicationEvent?

    ‏2011-03-30T02:30:34Z  in response to denisF
    You were right.
    Getting the BeanManager with a JNDI lookup works!
    I have identified my "real" problem related to CDI
    I open another thread