• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

Question on exceptions

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 2108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
This cake looks terrible, but it tastes great! Now take a bite out of this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic