File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Non application exception in local client Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Non application exception in local client" Watch "Non application exception in local client" New topic
Author

Non application exception in local client

Shiang Wang
Ranch Hand

Joined: Jun 20, 2003
Posts: 96
A question about exception on ejbcertificate site

If a local client in a transaction context invokes a business method on a bean with container-managed transactions, what exception does the client receive if the bean instance throws a non-application exception?

The answer is javax.ejb.TransactionRolledbackLocalException, why is it not javax.ejb.EJBException?

This really confuses me

When the transaction is rolled back by CONTAINER in the result of system exception, and a client try to commit the transaction, transactionRolledback(Local)Exception will thrown.

When the transaction is marked rollback only by bean, and a client try to commit the transaction, the TransactionRolledback(Local)Exception will NOT thrown.

Am I right ?
Why is TransactionRolledback(Local)Exception thrown in the above situation?

Thanks
Shiang


SCBCD, SCWCD, SCJP
Shiang Wang
Ranch Hand

Joined: Jun 20, 2003
Posts: 96
After I review Val's cheap sheet on exception, I realize this has something to do with if the tx is started by the caller or not. If the exception occurs in the same tx context as the caller, the TransactionRolled(Local)backException will be thrown, otherwise client will receive either EJBException or RemoteException.

Oh another thing I like to clear out, just for my own benefit, is that bean provider can't never throw RemoteException, it should be always wrapped as an EJBException. The remote client will receive RemoteException, local client will receive EJBException.

Shiang
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Non application exception in local client