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 Question from ejbcertificate.com Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Reply Bookmark "Question from ejbcertificate.com" Watch "Question from ejbcertificate.com" New topic
Author

Question from ejbcertificate.com

Li Xin
Ranch Hand

Joined: Feb 06, 2004
Posts: 37
Which of the following statements are true when a session bean's client receives a java.rmi.RemoteException? [Check all correct answers]
1. The container does not throw the java.rmi.RemoteException if the container performs a transaction rollback.
2. The client will never receives a java.rmi.RemoteException.
3. The client calls the session bean from another JVM.
4. The client calls the session bean from within the same JVM.
5. The throws clauses of all methods in the remote home and component interface must declare a java.rmi.RemoteException.
The provided answer is 1, 3 and 5, I don't understand why 1 is correct, can anyone explain?
Thanks!
Janne Karhu
Ranch Hand

Joined: Oct 29, 2003
Posts: 33
If the bean runs in a tx context of the caller (and thus have a tx attribute of Mandatory, Required or Supports) and the bean throws a system exception, the (remote) client gets a TransactionRolledBackedException (which is a subclass of RemoteException). However, if the bean does not throw a system exception but calls ctx.setRollbackOnly() instead (making the transaction doomed to eventually rollback), the client does not get an exception other than a possible application exception thrown directly from the bean class. So, the 1 would be right in the context of client started transaction (because the container throws a TransactionRolledbackException not RemoteException).
BUT, if the bean starts a new transaction (and thus has a tx attribute of RequiresNew) and the container rolls back the transaction for any reason, the client gets a RemoteException (making the 1 incorrect).
Same also applies to local clients, but exceptions are different (TransactionRolledbackLocal and EJBException).

Originally posted by Li Xin:
Which of the following statements are true when a session bean's client receives a java.rmi.RemoteException? [Check all correct answers]
1. The container does not throw the java.rmi.RemoteException if the container performs a transaction rollback.
2. The client will never receives a java.rmi.RemoteException.
3. The client calls the session bean from another JVM.
4. The client calls the session bean from within the same JVM.
5. The throws clauses of all methods in the remote home and component interface must declare a java.rmi.RemoteException.
The provided answer is 1, 3 and 5, I don't understand why 1 is correct, can anyone explain?
Thanks!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question from ejbcertificate.com
 
Similar Threads
java.rmi.RemoteException
RemoteException
mock exam question - ejbcertifate.com
Question from Mock Exam - ejbcertificate.com
mock exam question