• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Question on exceptions

 
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.
 
Ranch Hand
Posts: 2107
  • 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.
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please refer to the 2 years ago post

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