This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to send EJB layer Exception to WEB layer?  RSS feed

 
Sean Li
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a session-bean which has a createForm(...)method. this method only return true or false. but when run this method, some exceptions could happen. while I can only return a false to client.
I want to use a Exception to do this job. but I don't know how to send EJB layer exception to WEB layer, because only RemoteException is thrown by EJBObject interface.
what should I do. Is there any best solution?
Please help me, thanks!
 
Michael Arndt
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Add a class CustomException that implements Serializable and is accessible to both, web and ejb-layer, add this exception to your remote interface declaration of createForm() and add the throws clause to the createForm()-method of your bean implementation.
Always remember that custom exceptions do not force a transaction to be rolled back.
Regards, Michael
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sean, since you say that only RemoteExeptions can be thrown, can I assume you're using EJB 1.0?
Kyle
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!