Mail Archive Home | jotm List | October 2006 Index
Start a new transaction when the current transaction will be rollbacked
- Subject: Start a new transaction when the current transaction will be rollbacked
- From: Jérôme Besnainou <jerome.besnainou@xxxxxxxxxxxx>
- Date: Wed, 4 Oct 2006 19:35:23 +0200
Title: Message
Hello,
I'm using
jonas_4_7_4 and Joram_4_3_20.
My transaction are
Bean managed.
Here is my
scenario :
I have a MDBean
(simple3) which calls method add of a Remote Session EJB
(simple1).
The method
add of the Remote Session EJB (simple1) throw
EJBException.
The MDBean
(simple3) catch this exception (which was transformed by the
container into RemoteException) and call method add2 of an Remote
Session EJB (simple2).
Here are my
transactional attributes :
onMessage
of simple3 is in REQUIRED
add of
simple1 is in REQUIRED
add2 of
simple2 is in REQUIRESNEW
So I have two
transactions one stated by onMessage of simple3 (where add method of simple1 is
included) and one started by add2 of simple2.
The transaction
started by onMEssage is rollbacked while the one stated by add2 is commited
-> I think it is normal (could you confirm ?)
However I
see this stack trace on the log :
2006-10-04 18:51:00,566 : Current.resume :
RollbackException occured in resume()
2006-10-04 18:51:00,566 :
JFactory.postInvoke : cannot resume
transaction
javax.transaction.SystemException: RollbackException in occured
in resume() Transaction already marked for
rollback
at
org.objectweb.jotm.Current.resume(Current.java:848)
at
org.objectweb.jonas_ejb.container.JFactory.postInvoke(JFactory.java:687)
at
org.objectweb.jonas_ejb.container.JFactory.postInvokeRemote(JFactory.java:783)
at
org.objectweb.jonas_ejb.container.JSessionRemote.postInvoke(JSessionRemote.java:270)
at
org.objectweb.jonas_gen.com.edifixio.exemple.service.simple2.JOnASSimple2ServiceEJB235365813Remote.add2(JOnAS
Simple2ServiceEJB235365813Remote.java:176)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at
java.lang.reflect.Method.invoke(Method.java:585)
at
sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
at
org.objectweb.carol.rmi.jrmp.server.JUnicastServerRef.dispatch(JUnicastServerRef.java:143)
at
sun.rmi.transport.Transport$1.run(Transport.java:153)
at java.security.AccessController.doPrivileged(Native
Method)
at
sun.rmi.transport.Transport.serviceCall(Transport.java:149)
at
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:595)
Note: it is only a stack trace no
Exception are thrown to my application
Here is the
MDBean onMessage code :
try
{
Simple1Service mySimpleService =
((Simple1ServiceHome)(PortableRemoteObject.narrow(new
InitialContext().lookup("Simple1ServiceHome"),Simple1ServiceHome.class))).create();
mySimpleService.add(simpleId);
}
catch
(Exception e){
Simple2Service mySimpleService =
((Simple2ServiceHome)(PortableRemoteObject.narrow(new
InitialContext().lookup("Simple2ServiceHome"),Simple2ServiceHome.class))).create();
mySimpleService.add2(simpleId);
//throw
e;
}
Questions
:
First of all, is it
allowed to do such a scenario (=start a new transaction when the current
transaction will be rollbacked) ?
If it is allowed,
why is there this stack trace ?
Note: if I replace the MDBean (simple3)
by a Remote EJB (simple3bis), I do not see the previous stack
trace.
I hope I'm clear, if
you need more information do not hesitate
Best
Regards,
Jérôme
- Start a new transaction when the current transaction will be rollbacked,
Jérôme Besnainou
Powered by MHonArc.
Copyright © 2006-2007, OW2 Consortium | contact | webmaster.