Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question on exceptions

 
Sven Thor
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In HF EJB on page 559, the first scenario, the question is what happens when a "Client calls remove() on a bean that's already been removed" ?

The answer according to HF EJB is that a remote client receives a RemoteException and a local client receives an EJBException. Why do these clients not receive the more specific exceptions NoSuchObjectException or NoSuchObjectLocalException respectively ? Or maybe they do ?

Br,
Sven T.
 
Jesus Angeles
Ranch Hand
Posts: 2068
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, they do 'extend' their parent RemoteException and EJBException.

May I know if this is a question in the book, with multiple choices? Can you post here the entire question and choices?
 
Sven Thor
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's from an excercise where you are supposed to guess what kind of exception might occur for specific scenarios.

The scenario:
"Client calls remove() on a bean that's already been removed"

The explanation:
"You might be tempted to say RemoveException, but that's not it. Remember, remove() is just another method in the bean's interface, and if you call it on a removed bean, you'll get the same exception you'd see if you called any other business method on a removed bean - remote clients get RemoteException and local clients get EJBException."

I understand the part about not receiving a RemoveException. However, I thought this was a case for NoSuchObjectException or NoSuchObjectLocalException. I would assume they should be used instead of RemoteException or EJBException in the same way that the more specific exceptions ObjectNotFoundException and DuplicatKeyException are used instead of their more generic parent exceptions FinderException and CreateException when a single-ref finder/select fails or bean creation fails.

Can anyone clarify ?

Br,
Sven T.
 
Leyong
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please refer to the 2 years ago post

http://www.coderanch.com/t/158498/java-EJB-SCBCD/certification/HF-EJB-Book-Page-Clarification
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic