Topic
  • 4 replies
  • Latest Post - ‏2011-03-30T02:30:34Z by denisF
denisF
denisF
12 Posts

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

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

    ‏2011-03-25T19:28:33Z  
    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

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

    ‏2011-03-26T22:24:26Z  
    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

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

    ‏2011-03-28T14:38:59Z  
    • denisF
    • ‏2011-03-26T22:24:26Z
    Strange because WAS emits this message in the logs...

    <pre class="jive-pre"> BeansDeployer I BeansDeployer validateInjectionPoints All injection points were validated successfully. WebContainerL I WebContainerLifecycle startApplication OpenWebBeans Container has started, it took [121] ms </pre>
    I would like to have an official answer on this as it looks like a bug
    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

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

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