Hi All,
I am trying to
test creation of a stateful session bean to validate my understanding.
To my surprise, the bean is getting instantiated twice in the same session, so I am confused.
This is what I have done:
1) Declared a stateful session bean as follows:
2) Created a ServiceLocator class to look-up
EJB components.
3) Invoked look-up method of ServiceLocator from
servlet to get required stateful session bean.
4) I am looking up the same bean in two servlets. These servlets are invoked in a single session.
I expected that only one session bean be returned in both the servlets, but the bean's constructor is called 2 times.
Any pointers would be very much helpful.
Thanks.