This week's book giveaway is in the Agile/Processes forum.
We're giving away four copies of Building Green Software: A Sustainable Approach to Software Development and Operations and have Anne Currie, Sarah Hsu , Sara Bergman on-line!
See this thread for details.
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Session beans

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the HFE book, Chapert 4 Mock exam question answer on page 252 says according to Spec on page 72, Container can throw java.rmi.RemoteException.

But the Spec says only the subclass of RemoteException, NoSuchObjectException can be thrown, Can someone clarify this please.

Thank you.
 
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Will Hunt:
...
But the Spec says only the subclass of RemoteException, NoSuchObjectException can be thrown, Can someone clarify this please.
Thank you.



From EJB Specs, paragraph 18.2.2:



The container catches a non-application exception; logs it (which can result in alerting the System
Administrator); and, unless the bean is a message-driven bean, throws the java.rmi.RemoteException
(or subclass thereof) to the client if the client is a remote client or web service client, or
throws the javax.ejb.EJBException (or subclass thereof) to the client if the client is a local client.
In the case of a message-driven bean, the container logs the exception and then throws a
javax.ejb.EJBException that wraps the original exception to the resource adapter. (See [12]).



As you can see the container throws a RemoteException (of subclass of it). If you think for a moment, it couldn't be otherwise. Not all the 'unexpected' exceptions from a remote client are received as NoSuchEntityException, on the opposite, this is a very specific exception. On the other end, having a RemoteException thrown by the container to a remote client (I'm insisting on *Remote*, because a *Local* client will get an EJBException, subsclass of RuntimeException, therefore unchecked), is a mean for the Container to say to the client: 'Hey, something went bad on the other side of the wire'.
 
reply
    Bookmark Topic Watch Topic
  • New Topic