• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

EJBTransactionRollbackException thrown to remote or local client?

 
Bartender
Posts: 2418
13
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Bartender
Posts: 1558
5
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Bartender
Posts: 2418
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic