• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB3: Exception handling in client code

 
Morten Franorge
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)
 
Jeroen T Wenting
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The client will get the application exception wrapped in another exception.
 
Mike Keith
author
Ranch Hand
Posts: 304
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Morten Franorge
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Mike, for the reply.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic