Discussion:
Transaction with RemoteEJB
Thiago Rodrigues
2017-11-19 12:25:02 UTC
Permalink
Hi, I am testing remote server Transaction Context Propagation.

My application is like that and Tomee server version is 1.7.1

call
Server A (EJB 1) ========> Server B (EJB 2)
| |
| |
| |
DB 1 DB 2

EJB 1 is CMT and @TransactionAttribute(TransactionAttributeType
.REQUIRES_NEW)
EJB 2 is CMT and @TransactionAttribute(TransactionAttributeType.MANDATORY)

I want to execute EJB 1 which works with DB1, then calls EJB 2 which works
with DB2
in a single global transaction.

when EJB 1 calls EJB 2 in remote server, It throws
TransactionRequiredLocalException Exception.
How to propagate transaction context to the remote server?
Romain Manni-Bucau
2017-11-19 12:33:04 UTC
Permalink
Hi

Transactions are local until you use a XA system. EJB doesnt handle that in
tomee bit if the ejb2 call throws an exception and propagates it in ejb1
then a rollback will be done in both systems.


Le 19 nov. 2017 13:25, "Thiago Rodrigues" <***@gmail.com> a écrit :

Hi, I am testing remote server Transaction Context Propagation.

My application is like that and Tomee server version is 1.7.1

call
Server A (EJB 1) ========> Server B (EJB 2)
| |
| |
| |
DB 1 DB 2

EJB 1 is CMT and @TransactionAttribute(TransactionAttributeType
.REQUIRES_NEW)
EJB 2 is CMT and @TransactionAttribute(TransactionAttributeType.MANDATORY)

I want to execute EJB 1 which works with DB1, then calls EJB 2 which works
with DB2
in a single global transaction.

when EJB 1 calls EJB 2 in remote server, It throws
TransactionRequiredLocalException Exception.
How to propagate transaction context to the remote server?
Thiago Rodrigues
2017-11-19 12:53:06 UTC
Permalink
Hi
Thans for the quick response!

If i remove the MANDATORY from EJB2 everything works fine, but EJB2 perform
inserts (with XA Oracle Datasource), but if an exception are thrown in
EJB1(after the EJB2 response) all the operations made in ejb1 are
rolledback but the data inserted by ejb2 are commited (probably because
there is no transaction propagation from ejb1 to ejb2 and a new transaction
are created). I made this work in other AS such wildlfy and wl... but i
would really like to made this work in tomee.
Post by Romain Manni-Bucau
Hi
Transactions are local until you use a XA system. EJB doesnt handle that in
tomee bit if the ejb2 call throws an exception and propagates it in ejb1
then a rollback will be done in both systems.
Hi, I am testing remote server Transaction Context Propagation.
My application is like that and Tomee server version is 1.7.1
call
Server A (EJB 1) ========> Server B (EJB 2)
| |
| |
| |
DB 1 DB 2
.REQUIRES_NEW)
I want to execute EJB 1 which works with DB1, then calls EJB 2 which works
with DB2
in a single global transaction.
when EJB 1 calls EJB 2 in remote server, It throws
TransactionRequiredLocalException Exception.
How to propagate transaction context to the remote server?
--
Atenciosamente,
Thiago Rodrigues
***@dpaper.com.br
Yann Blazart
2017-11-19 12:58:12 UTC
Permalink
Wait Romain.

You mean remote ejb TX do not work with tomee ???

That is a big problem
Post by Thiago Rodrigues
Hi
Thans for the quick response!
If i remove the MANDATORY from EJB2 everything works fine, but EJB2 perform
inserts (with XA Oracle Datasource), but if an exception are thrown in
EJB1(after the EJB2 response) all the operations made in ejb1 are
rolledback but the data inserted by ejb2 are commited (probably because
there is no transaction propagation from ejb1 to ejb2 and a new transaction
are created). I made this work in other AS such wildlfy and wl... but i
would really like to made this work in tomee.
On Sun, Nov 19, 2017 at 10:33 AM, Romain Manni-Bucau <
Post by Romain Manni-Bucau
Hi
Transactions are local until you use a XA system. EJB doesnt handle that
in
Post by Romain Manni-Bucau
tomee bit if the ejb2 call throws an exception and propagates it in ejb1
then a rollback will be done in both systems.
Hi, I am testing remote server Transaction Context Propagation.
My application is like that and Tomee server version is 1.7.1
call
Server A (EJB 1) ========> Server B (EJB 2)
| |
| |
| |
DB 1 DB 2
.REQUIRES_NEW)
MANDATORY)
Post by Romain Manni-Bucau
I want to execute EJB 1 which works with DB1, then calls EJB 2 which
works
Post by Romain Manni-Bucau
with DB2
in a single global transaction.
when EJB 1 calls EJB 2 in remote server, It throws
TransactionRequiredLocalException Exception.
How to propagate transaction context to the remote server?
--
Atenciosamente,
Thiago Rodrigues
Romain Manni-Bucau
2017-11-19 14:13:11 UTC
Permalink
Le 19 nov. 2017 13:58, "Yann Blazart" <***@bycode.fr> a écrit :

Wait Romain.

You mean remote ejb TX do not work with tomee ???


Not really, i meant with most servers "by design". Propagation is not
supposed to be done through remote calls.


That is a big problem
Post by Thiago Rodrigues
Hi
Thans for the quick response!
If i remove the MANDATORY from EJB2 everything works fine, but EJB2 perform
inserts (with XA Oracle Datasource), but if an exception are thrown in
EJB1(after the EJB2 response) all the operations made in ejb1 are
rolledback but the data inserted by ejb2 are commited (probably because
there is no transaction propagation from ejb1 to ejb2 and a new transaction
are created). I made this work in other AS such wildlfy and wl... but i
would really like to made this work in tomee.
On Sun, Nov 19, 2017 at 10:33 AM, Romain Manni-Bucau <
Post by Romain Manni-Bucau
Hi
Transactions are local until you use a XA system. EJB doesnt handle that
in
Post by Romain Manni-Bucau
tomee bit if the ejb2 call throws an exception and propagates it in ejb1
then a rollback will be done in both systems.
Hi, I am testing remote server Transaction Context Propagation.
My application is like that and Tomee server version is 1.7.1
call
Server A (EJB 1) ========> Server B (EJB 2)
| |
| |
| |
DB 1 DB 2
.REQUIRES_NEW)
MANDATORY)
Post by Romain Manni-Bucau
I want to execute EJB 1 which works with DB1, then calls EJB 2 which
works
Post by Romain Manni-Bucau
with DB2
in a single global transaction.
when EJB 1 calls EJB 2 in remote server, It throws
TransactionRequiredLocalException Exception.
How to propagate transaction context to the remote server?
--
Atenciosamente,
Thiago Rodrigues
David Jencks
2017-11-19 19:59:58 UTC
Permalink
I’m not sure I understand what Romain is saying so I will try to explain in my own words.

There are 2 things people generally mean when they talk about XA or two-phase transaction support.

1. One server with more than one transactional resource, typically databases and messaging. A transaction is started on this one server, “inside” the transaction various DBs and messaging are accessed, and the transaction is ended. The server “propagates” the transaction to the DBs etc and uses 2-phase commit to ensure consistent results across resources. EJB servers have to support this (although they are not required to support automatic recovery from failure) and Tomee supports this.

2. More than one server, where a transaction is started on one server and a remote ejb call to another server requires propagating the transaction to that second server. Supporting this is optional, for good reason. I have never encountered a situation with non-fossilized code where this is a remotely plausible architectural choice. Put all the ejbs on the same server and run multiple copies of the same server. Tomee does not support this.

Hope this reduces rather than adds to confusion :-)

David Jencks
Post by Yann Blazart
Wait Romain.
You mean remote ejb TX do not work with tomee ???
Not really, i meant with most servers "by design". Propagation is not
supposed to be done through remote calls.
That is a big problem
Post by Thiago Rodrigues
Hi
Thans for the quick response!
If i remove the MANDATORY from EJB2 everything works fine, but EJB2
perform
Post by Thiago Rodrigues
inserts (with XA Oracle Datasource), but if an exception are thrown in
EJB1(after the EJB2 response) all the operations made in ejb1 are
rolledback but the data inserted by ejb2 are commited (probably because
there is no transaction propagation from ejb1 to ejb2 and a new
transaction
Post by Thiago Rodrigues
are created). I made this work in other AS such wildlfy and wl... but i
would really like to made this work in tomee.
On Sun, Nov 19, 2017 at 10:33 AM, Romain Manni-Bucau <
Post by Romain Manni-Bucau
Hi
Transactions are local until you use a XA system. EJB doesnt handle that
in
Post by Romain Manni-Bucau
tomee bit if the ejb2 call throws an exception and propagates it in ejb1
then a rollback will be done in both systems.
Hi, I am testing remote server Transaction Context Propagation.
My application is like that and Tomee server version is 1.7.1
call
Server A (EJB 1) ========> Server B (EJB 2)
| |
| |
| |
DB 1 DB 2
.REQUIRES_NEW)
MANDATORY)
Post by Romain Manni-Bucau
I want to execute EJB 1 which works with DB1, then calls EJB 2 which
works
Post by Romain Manni-Bucau
with DB2
in a single global transaction.
when EJB 1 calls EJB 2 in remote server, It throws
TransactionRequiredLocalException Exception.
How to propagate transaction context to the remote server?
--
Atenciosamente,
Thiago Rodrigues
Yann Blazart
2017-11-20 11:47:52 UTC
Permalink
Well, I just read again ejb 3.2 spec,

At 10.6.1.1, of what I understand, context propagation must be.

???
I’m not sure I understand what Romain is saying so I will try to explain
in my own words.
There are 2 things people generally mean when they talk about XA or
two-phase transaction support.
1. One server with more than one transactional resource, typically
databases and messaging. A transaction is started on this one server,
“inside” the transaction various DBs and messaging are accessed, and the
transaction is ended. The server “propagates” the transaction to the DBs
etc and uses 2-phase commit to ensure consistent results across resources.
EJB servers have to support this (although they are not required to support
automatic recovery from failure) and Tomee supports this.
2. More than one server, where a transaction is started on one server and
a remote ejb call to another server requires propagating the transaction to
that second server. Supporting this is optional, for good reason. I have
never encountered a situation with non-fossilized code where this is a
remotely plausible architectural choice. Put all the ejbs on the same
server and run multiple copies of the same server. Tomee does not support
this.
Hope this reduces rather than adds to confusion :-)
David Jencks
Post by Yann Blazart
Wait Romain.
You mean remote ejb TX do not work with tomee ???
Not really, i meant with most servers "by design". Propagation is not
supposed to be done through remote calls.
That is a big problem
Post by Thiago Rodrigues
Hi
Thans for the quick response!
If i remove the MANDATORY from EJB2 everything works fine, but EJB2
perform
Post by Thiago Rodrigues
inserts (with XA Oracle Datasource), but if an exception are thrown in
EJB1(after the EJB2 response) all the operations made in ejb1 are
rolledback but the data inserted by ejb2 are commited (probably because
there is no transaction propagation from ejb1 to ejb2 and a new
transaction
Post by Thiago Rodrigues
are created). I made this work in other AS such wildlfy and wl... but i
would really like to made this work in tomee.
On Sun, Nov 19, 2017 at 10:33 AM, Romain Manni-Bucau <
Post by Romain Manni-Bucau
Hi
Transactions are local until you use a XA system. EJB doesnt handle
that
Post by Yann Blazart
Post by Thiago Rodrigues
in
Post by Romain Manni-Bucau
tomee bit if the ejb2 call throws an exception and propagates it in
ejb1
Post by Yann Blazart
Post by Thiago Rodrigues
Post by Romain Manni-Bucau
then a rollback will be done in both systems.
Hi, I am testing remote server Transaction Context Propagation.
My application is like that and Tomee server version is 1.7.1
call
Server A (EJB 1) ========> Server B (EJB 2)
| |
| |
| |
DB 1 DB 2
.REQUIRES_NEW)
MANDATORY)
Post by Romain Manni-Bucau
I want to execute EJB 1 which works with DB1, then calls EJB 2 which
works
Post by Romain Manni-Bucau
with DB2
in a single global transaction.
when EJB 1 calls EJB 2 in remote server, It throws
TransactionRequiredLocalException Exception.
How to propagate transaction context to the remote server?
--
Atenciosamente,
Thiago Rodrigues
Romain Manni-Bucau
2017-11-20 12:54:01 UTC
Permalink
Yep, this is not a spec feature (10.6, this is optional and
unspecified in term of protocol).

Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Post by Yann Blazart
Well, I just read again ejb 3.2 spec,
At 10.6.1.1, of what I understand, context propagation must be.
???
Post by David Jencks
I’m not sure I understand what Romain is saying so I will try to explain
in my own words.
There are 2 things people generally mean when they talk about XA or
two-phase transaction support.
1. One server with more than one transactional resource, typically
databases and messaging. A transaction is started on this one server,
“inside” the transaction various DBs and messaging are accessed, and the
transaction is ended. The server “propagates” the transaction to the DBs
etc and uses 2-phase commit to ensure consistent results across resources.
EJB servers have to support this (although they are not required to support
automatic recovery from failure) and Tomee supports this.
2. More than one server, where a transaction is started on one server and
a remote ejb call to another server requires propagating the transaction to
that second server. Supporting this is optional, for good reason. I have
never encountered a situation with non-fossilized code where this is a
remotely plausible architectural choice. Put all the ejbs on the same
server and run multiple copies of the same server. Tomee does not support
this.
Hope this reduces rather than adds to confusion :-)
David Jencks
Post by Yann Blazart
Wait Romain.
You mean remote ejb TX do not work with tomee ???
Not really, i meant with most servers "by design". Propagation is not
supposed to be done through remote calls.
That is a big problem
Post by Thiago Rodrigues
Hi
Thans for the quick response!
If i remove the MANDATORY from EJB2 everything works fine, but EJB2
perform
Post by Thiago Rodrigues
inserts (with XA Oracle Datasource), but if an exception are thrown in
EJB1(after the EJB2 response) all the operations made in ejb1 are
rolledback but the data inserted by ejb2 are commited (probably because
there is no transaction propagation from ejb1 to ejb2 and a new
transaction
Post by Thiago Rodrigues
are created). I made this work in other AS such wildlfy and wl... but i
would really like to made this work in tomee.
On Sun, Nov 19, 2017 at 10:33 AM, Romain Manni-Bucau <
Post by Romain Manni-Bucau
Hi
Transactions are local until you use a XA system. EJB doesnt handle
that
Post by Yann Blazart
Post by Thiago Rodrigues
in
Post by Romain Manni-Bucau
tomee bit if the ejb2 call throws an exception and propagates it in
ejb1
Post by Yann Blazart
Post by Thiago Rodrigues
Post by Romain Manni-Bucau
then a rollback will be done in both systems.
Hi, I am testing remote server Transaction Context Propagation.
My application is like that and Tomee server version is 1.7.1
call
Server A (EJB 1) ========> Server B (EJB 2)
| |
| |
| |
DB 1 DB 2
.REQUIRES_NEW)
MANDATORY)
Post by Romain Manni-Bucau
I want to execute EJB 1 which works with DB1, then calls EJB 2 which
works
Post by Romain Manni-Bucau
with DB2
in a single global transaction.
when EJB 1 calls EJB 2 in remote server, It throws
TransactionRequiredLocalException Exception.
How to propagate transaction context to the remote server?
--
Atenciosamente,
Thiago Rodrigues
Yann Blazart
2017-11-20 13:04:37 UTC
Permalink
Hoooo damned sorry. I missed this point.

Very bad news, this was a major advantage....

I m sad that TomEE is not able to do that.

Sometimes it could be usefull
Post by Romain Manni-Bucau
Yep, this is not a spec feature (10.6, this is optional and
unspecified in term of protocol).
Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Post by Yann Blazart
Well, I just read again ejb 3.2 spec,
At 10.6.1.1, of what I understand, context propagation must be.
???
I’m not sure I understand what Romain is saying so I will try to explain
in my own words.
There are 2 things people generally mean when they talk about XA or
two-phase transaction support.
1. One server with more than one transactional resource, typically
databases and messaging. A transaction is started on this one server,
“inside” the transaction various DBs and messaging are accessed, and the
transaction is ended. The server “propagates” the transaction to the
DBs
Post by Yann Blazart
etc and uses 2-phase commit to ensure consistent results across
resources.
Post by Yann Blazart
EJB servers have to support this (although they are not required to
support
Post by Yann Blazart
automatic recovery from failure) and Tomee supports this.
2. More than one server, where a transaction is started on one server
and
Post by Yann Blazart
a remote ejb call to another server requires propagating the
transaction to
Post by Yann Blazart
that second server. Supporting this is optional, for good reason. I
have
Post by Yann Blazart
never encountered a situation with non-fossilized code where this is a
remotely plausible architectural choice. Put all the ejbs on the same
server and run multiple copies of the same server. Tomee does not
support
Post by Yann Blazart
this.
Hope this reduces rather than adds to confusion :-)
David Jencks
On Nov 19, 2017, at 6:13 AM, Romain Manni-Bucau <
Wait Romain.
You mean remote ejb TX do not work with tomee ???
Not really, i meant with most servers "by design". Propagation is not
supposed to be done through remote calls.
That is a big problem
Post by Thiago Rodrigues
Hi
Thans for the quick response!
If i remove the MANDATORY from EJB2 everything works fine, but EJB2
perform
Post by Thiago Rodrigues
inserts (with XA Oracle Datasource), but if an exception are thrown
in
Post by Yann Blazart
Post by Thiago Rodrigues
EJB1(after the EJB2 response) all the operations made in ejb1 are
rolledback but the data inserted by ejb2 are commited (probably
because
Post by Yann Blazart
Post by Thiago Rodrigues
there is no transaction propagation from ejb1 to ejb2 and a new
transaction
Post by Thiago Rodrigues
are created). I made this work in other AS such wildlfy and wl...
but i
Post by Yann Blazart
Post by Thiago Rodrigues
would really like to made this work in tomee.
On Sun, Nov 19, 2017 at 10:33 AM, Romain Manni-Bucau <
Post by Romain Manni-Bucau
Hi
Transactions are local until you use a XA system. EJB doesnt handle
that
Post by Thiago Rodrigues
in
Post by Romain Manni-Bucau
tomee bit if the ejb2 call throws an exception and propagates it in
ejb1
Post by Thiago Rodrigues
Post by Romain Manni-Bucau
then a rollback will be done in both systems.
Hi, I am testing remote server Transaction Context Propagation.
My application is like that and Tomee server version is 1.7.1
call
Server A (EJB 1) ========> Server B (EJB 2)
| |
| |
| |
DB 1 DB 2
.REQUIRES_NEW)
MANDATORY)
Post by Romain Manni-Bucau
I want to execute EJB 1 which works with DB1, then calls EJB 2 which
works
Post by Romain Manni-Bucau
with DB2
in a single global transaction.
when EJB 1 calls EJB 2 in remote server, It throws
TransactionRequiredLocalException Exception.
How to propagate transaction context to the remote server?
--
Atenciosamente,
Thiago Rodrigues
Loading...