This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Session Managed beans are constructed on-demand, not at session create time. If you don't yet have a session, or the JSF framework hasn't yet requested that object, it won't exist yet.
If so, you can always construct your own session and session scoped object. JSF won't care. It will still use the session object you've created as though it had created the object itself.
In the case of managed beans with injected properties, you may prefer to ask JSF to construct the managed bean for you so that it will apply the rules defined in the faces-config file. You'll have to look up how to do that - I don't have that info handy.
But in your case, there's nothing in faces-config that you can't do by hand. Either way works.
An IDE is no substitute for an Intelligent Developer.
Joined: Apr 27, 2009
The problem was as you said mb are constructed on-demand. I create a new session object and now everything is working properly