If a runtime exception is thrown from the afterBegin()
method of the javax.ejb.SessionSynchronization
interface, the error is simply logged and ignored. The
exception needs to be rethrown to the parent class, so
the transaction can be rolled back and then ignore the
public class StatefulSessionInstanceInterceptor
private class InstanceSynchronization implements
public void afterBegin()
catch (Exception e)
*************This is the problem********************
log.error("failed to invoke
A runtime exception needs to be thrown to the calling
object so that proper transaction cleanup can occur.
This exception needs to then be propagated back to the
client. Also the main session bean method should not
be called after a runtime exception is thrown. As of
right now, the session bean method is executed
regardless. It's vitally important that the original
transaction is passed back to the calling client.
Depending on the nature of the runtime exception, the
client may be able to handle situation.
I can provide a working junit testcase if needed.
Log in to post a comment.