This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Exception qustion in HFEJB 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 "Exception qustion in HFEJB" Watch "Exception qustion in HFEJB" New topic
Author

Exception qustion in HFEJB

Shiang Wang
Ranch Hand

Joined: Jun 20, 2003
Posts: 96
Page. 564 #4
Which of the following are EJB 2.0 specification guidelines regarding system exception?
.
.
B. Bean methods should wrap unrecoverable checked exception in a javax.ejb.EJBException exception.
C. For remote clients, bean methods should wrap unrecoverable checked exception in a java.rmi.RemoteException.

Answer is B only.

Why c is not correct? I know checked exception includes RemoteException, and container will handle that, no problem here. But there might not other unrecoverable checked exceptions, you will want to let container handle the rollback, clean up process by wrapping them up as RemoteException. :roll:

Thanks
Shiang


SCBCD, SCWCD, SCJP
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
As of the EJB 2.0 specification, the bean methods are not allowed to declare (and throw) RemoteException anymore. Check out section 18.2.2 (System exceptions) of the EJB 2.0 specification which clearly explains how beans should process unrecoverable error conditions.


SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
Shiang Wang
Ranch Hand

Joined: Jun 20, 2003
Posts: 96
Thanks, I was confused by the role of bean provider and the client. Bean providers should wrap it up as EJBException NO MATTER WHAT, clients will receive them differently depends on whether it is remote or local.

Shiang
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exception qustion in HFEJB
 
Similar Threads
RemoteException
Problem with Session Beans
What Exception does the EJBCOntainer Throw
Regarding throwing java.rmi.RemoteException
HFEJB - pg 564 - Exceptions: question 4.