• 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
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

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'.
 
I'm so happy! And I wish to make this tiny ad happy too:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic