• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJBTransactionRollbackException thrown to remote or local client?

 
Himai Minh
Ranch Hand
Posts: 1360
7
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to this API :http://docs.oracle.com/javaee/6/api/javax/ejb/EJBTransactionRolledbackException.html
It says, EJBTransactionRollbackException is thrown to a remote client telling the client that the client's transaction is marked for rollback or has been rolled back.

But when I tried, this exception can be thrown to a local callee bean which in the same .war file as the bean that throws a system exception and causes the transaction to be marked for rollback.


I have two more days before my exam. I am keeping my fingers cross now.

 
Anayonkar Shivalkar
Bartender
Posts: 1557
5
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Somehow, I'm not able to find any reference which mentions that this exception cannot be thrown to local client

Further, according to section 14.3.1 of EJB Sepcification:
If the business interface is a remote business interface that extends java.rmi.Remote, the javax.transaction.TransactionRolledbackException is thrown to the client, which will receive this exception.

(here, 'this' exception means EJBTransactionRollbackException) - so it seems that this exception can be thrown to local client as well.

Can you recheck the scenario with no-interface view?
 
Himai Minh
Ranch Hand
Posts: 1360
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried with two @LocalBean , BeanA and BeanB. The servlet client and the beans are in the same .war file. The EJBTransactionRollbackException is thrown to BeanA, even though BeanA and BeanB are local to each other.





Output:
Warning: A system exception occurred during an invocation on EJB BeanA method public void com.ivan.scbcd6.BeanA.methodA()
javax.ejb.EJBTransactionRolledbackException
.....
Caused by: javax.ejb.TransactionRolledbackLocalException: Exception thrown from bean
...
Caused by: java.lang.RuntimeException: run time exception from b
at com.ivan.scbcd6.BeanB.methodB(BeanB.java:26)

Warning: StandardWrapperValve[OtherServlet]: PWC1406: Servlet.service() for servlet OtherServlet threw exception
javax.ejb.EJBTransactionRolledbackException
 
Igor Makarov
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys.
Some time ago I was investigating this question also.

The conclusion is (14.3.1 of EJB Sepcification):
If you're using EJB 3.x approach the EJBTransactionRolledBackException for both Local and Remote beans.
If you're using EJB 2.1 then exception depends on if it's Local (EJBTransactionRolledBackException) or Remote (javax.transaction.TransactionRolledbackException) bean.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic