I am using Websphere 5.0 with EJB 2.0 statless session beans.
Is it possible that during execution of a business method I get sessionContext == null ? For example, if business method invokes a database query and session timeout occurs due to database lock or something. If it is not possible in this case is there any other case in which this is possible ?
You get session context during setSessionContex call. You should store it in you bean if you want to access it later.
Yes I am storing the session context in the setSessionContext method into an instance variable in the (session bean) class.
My question was that is it possible this instance variable may become null while the execution of a business method exposed by the session bean.
For example, in case transaction timeout occurs due to a database lock during a database operation triggered in that business method.
I am using the session context instance variable sometime after the call to database operation returns or throws exception in case of timeout due to database lock. Can I get a null pointer on calling any SessionContext interface method on the session context instance variable ?