I'm using MyFaces 1.1.6. Does anyone know where JSF records what happens when it is trying to initialize a session bean? I have this code ...
but when my session starts up, it is nowhere to be found -- i.e. it does not appear in the session. I'm guessing an error occurred but I don't see anything in my stdout or stderr logs (I'm using JBoss 5.1 on Mac 10.5.6). Any ideas how I can figure out why my session bean is not getting created? - Dave
You'd have to crank up the javax.faces logging level. But if you're really failing on bean instantiation, there should be a stacktrace. In vanilla tomcat that would be in the catalina.out or localhost logfiles. In JBoss, look in your server's log directory. I think the name is something like "server.log", so it's not hard to find.
An IDE is no substitute for an Intelligent Developer.
Joined: Jul 02, 2008
Since I have defined this bean in the session scope, when should this bean actually be created and registered to the session? -
Managed beans are created on demand. When a session is created, the session beans are not automatically created. However, if there is no session, then referencing a session bean in a JSF view will cause the session to be created, the session bean to be instantiated and the instantiated bean to be stored in the session.
The most important thing to bear in mind is that if you have non-JSF code, that means that a lookup of the session bean will return null until it has either been instantiated by being referenced in a JSF view or it is manually instantiated (and manually initialized) by non-JSF code. JSF Managed session beans are no different than any other session beans except for the fact that JSF will use information from faces-config to instantiate and initialize them, if needed.