This content has been marked as final.
Show 1 reply
-
1. Re: @EJB does not work in JSF backing bean constructor
jaikiran Feb 4, 2009 10:37 AM (in response to perfectionist)"perfectionist" wrote:
The problem was the injected reference to the stateless session bean was being called one time from inside the constructor for the backing bean.
I haven't used JSF, but i think you should be using the injected reference after @PostConstruct and not in the constructor of the managed bean.public class MyBackingBean ... { @EJB private MyEJB ejb; public MyBackingBean() { ... // don't use the bean here, its not yet injected } @PostConstruct public void myPostConstruct() { // use the bean here, since this is called after // resources have been injected ejb.doSomething(); } ...