users@glassfish.java.net

RE: Re: javax.ejb.NoSuchObjectLocalException: Invalid Session Key

From: Markus Karg <karg_at_quipsy.de>
Date: Sat, 14 Mar 2009 18:37:08 +0100

Wolfram,

> 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.

Is this EJB 3.0 compliant? I mean, if that is true then actually EACH
method of EACH SB must be surrounded by try...catch(RuntimeException) --
what would be a lot of work! Can't believe that EJB 3 says that a SB
shall shut down if it catches a RuntimeException. Does it?

And, wouldn't there be a log entry in server.log naming that
RuntimeException? In my log there is none.

> 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.

Well, that would imply a lot of cluttering in the client code: Actually
you must catch the RemoteException at each of possibly thousands of
locations to recreate the session and retry the command...

BTW, is there any chance to see the cause of the session closure in some
log file?

Thanks for you kind answer, now I know what to look for...
Regards
Markus