wood burning stoves*
The moose likes EJB and other Java EE Technologies and the fly likes EJB3: Exception handling in client code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "EJB3: Exception handling in client code" Watch "EJB3: Exception handling in client code" New topic
Author

EJB3: Exception handling in client code

Morten Franorge
Ranch Hand

Joined: Jul 29, 2005
Posts: 137
Since the client has a reference to an instance of a business interface and not a remote interface how will the client be able to handle exceptions that may occur when working with remoting? (Given that the business interface only throws application exceptions)


SCJP 1.4, SCBCD 1.3, SCBCD 5.0, SCEA J2EE, SCEA 5.0
Jeroen T Wenting
Ranch Hand

Joined: Apr 21, 2006
Posts: 1847
The client will get the application exception wrapped in another exception.


42
Mike Keith
author
Ranch Hand

Joined: Jul 14, 2005
Posts: 304
Since the client has a reference to an instance of a business interface and not a remote interface how will the client be able to handle exceptions that may occur when working with remoting? (Given that the business interface only throws application exceptions)


Clients reference business interfaces, but underneath they still need to be generated impl classes that the Container can throw runtime exceptions from. An EJBException will wrap a RemoteException if one gets thrown from the RMI layer, you just aren't forced to catch it anymore. This is nice because most of the time you can't do anything reasonable with it in any case.

-Mike


-Mike
Pro JPA 2: Mastering the Java Persistence API
Morten Franorge
Ranch Hand

Joined: Jul 29, 2005
Posts: 137
Thanks Mike, for the reply.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EJB3: Exception handling in client code
 
Similar Threads
@Remote Annotation
Create methods throwing the unchecked exceptions...
BigSmoke inventory - Adapter or Facard?
EJBException and RemoteException
ServiceLocator in ClassDiagram of Big Smokes Cigar Shop applicaiton