user12159399 wrote:You seem to be stuck on doom scenarios. When things go bad, there isn't much you can do when servers start failing on you. What you expect the technology to do is break down, which will be the trigger to investigate what is really going on.
One more scenario came into my mind.
0. Servlet function execution starts
1. Servlet looks up stateless session bean
2. Servlet calls session bean (executed on server A)
3. Server A goes down
4. Servlet calls session bean again. We are still in the same Servlet function.
5. Servlet function end
So should bean always looked up for each call?Only in situations where the bean is not managed by the container. Objects stored in some sort of persistent storage (like a session) must not hold on to server managed resources, so you should do lookups.
What if server where EJB container is running goes off-line after lookup, but before EJB call?Then things go boom no matter how you got the EJB reference.