users@glassfish.java.net

Re: javax.ejb.NoSuchObjectLocalException: Invalid Session Key

From: Wolfram Rittmeyer <w.rittmeyer_at_jsptutorial.org>
Date: Sat, 14 Mar 2009 12:21:18 +0100

Markus Karg wrote:
> So what is the bug in my code and how to fix it? My code just opens a session at program start and closes it at session end. What could my code do that creates this condition?
>

This happens when a RuntimeException (or RemoteException) gets thrown
and is not caught within your SFSB. As soon as the container catches it,
your bean is toast. Thus you should look carefully at any calls you make
to other components and catch possible RuntimeExceptions and throw an
application-dependent exception instead. Any declared Exceptions (other
than Remote- and RuntimeExceptions) are expected exceptions and do not
cause your bean to be destroyed.

The other option is, that your client code realizes that an exception
has occured and thus creates a new SFSB to use from then on.


--
Wolfram Rittmeyer