#185 No Exception handling for afterBegin()

v2.4 (stable)
JBossCMP (86)

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

package org.jboss.ejb.plugins;
public class StatefulSessionInstanceInterceptor
private class InstanceSynchronization implements
public void afterBegin()
if (notifySession)
new Object[0]);
catch (Exception e)
*************This is the problem********************
log.error("failed to invoke
afterBegin", e);

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.


  • Scott M Stark

    Scott M Stark - 2002-04-05
    • assigned_to: nobody --> starksm
    • status: open --> closed-fixed
  • Scott M Stark

    Scott M Stark - 2002-04-05

    Logged In: YES

    An initial fix has been applied for 2.4.5


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks