-
1. Re: Error after throwing RuntimeException from stateful sess
annegret Apr 29, 2002 8:13 AM (in response to msquance)Hi Mike,
this behavior is according to the EJB Spec, read the chapter ExceptionHandling.
jboss discards the SessionBean after a RuntimeException or java.rmi.RemoteException.
To avoid this You can define an ApplicationException that MUST NOT extend from java.rmi.RemoteException but from java.lang.Exception, catch all Exceptions in your bean method and throw the ApplicationException instead.
Annegret -
2. Re: Error after throwing RuntimeException from stateful sess
msquance Apr 29, 2002 8:48 PM (in response to msquance)Hi,
I did see the reference to the "Discard instance" on one of the other posts on this subject, but I wasn't convinced that it was the answer. The EJB spec footnote says: "Discard instance means that the Container must not invoke any business methods or container callbacks
on the instance."
To me that does not imply that the bean is no longer usable. Also, the same information about discarding the instance is stated for entity beans, but entity beans are still accessible after a run-time exception.
My thought was also that if this is design intent, the exception being thrown would not be the FileNotFoundException, but something more meaningful.
Mike.