A browser took up a stateful session bean from another browser
 Technote (FAQ)
 
Problem
What is the relationship between a browser and stateful session bean.
 
Cause
It could be that the reference of the stateful session bean (SFSB) is kept as a member variable of the Servlet.
 
Solution
There is no relationship between a browser and an EJB. There may be a relationship between a Servlet and an EJB, where the Servlet is the client of the EJB but there is no direct relationship between the HTTP session and any persistent state of a stateful session bean.

The only way anything can relate to a stateful session bean (SFSB) is by having a reference to it. When calling a SFSB from a Servlet, you should keep the reference in an HTTPSession object, since an HTTP session is associated with exactly one browser. This way each client can have its own SFSB reference. Don't keep the reference in a servlet instance variable, since there's only a single servlet instance for all the clients/browsers that access that servlet.

If two calls are made to the same SFSB instance simultaneously, one of them will work but the other will get a BeanNotReentrantException (a subclass of RemoteException). Since this is likely to happen if you put the SFSB reference in a servlet instance variable, the instance variable technique is not recommended.
 
 
 


Document Information


Product categories: Software > Application Servers > Distributed Application & Web Servers > WebSphere Application Server > EJB Container
Operating system(s): OS/400
Software version: 4.0
Software edition:
Reference #: 1228229
IBM Group: Software Group
Modified date: Jan 19, 2006