#185 No Exception handling for afterBegin()

v2.4 (stable)
closed-fixed
Scott M Stark
JBossCMP (86)
5
2002-04-05
2002-03-30
Michael Rettig
No

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
Synchronization
..............
public void afterBegin()
{
if (notifySession)
{
try
{
afterBegin.invoke(ctx.getInstance(),
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.

Discussion

  • 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
    user_id=175228

    An initial fix has been applied for 2.4.5