The Artima Developer Community
Sponsored Link

Java Answers Forum
Handling System Exceptions in EJB

1 reply on 1 page. Most recent reply: Aug 28, 2003 5:00 AM by Senthoorkumaran Punniamoorthy

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
venkat

Posts: 4
Nickname: javaven
Registered: Aug, 2003

Handling System Exceptions in EJB Posted: Aug 28, 2003 1:30 AM
Reply to this message Reply
Advertisement
Can anyone please explain me why do we need throw the System Exceptions as EJBExceptions to the EJB Container ? what's the advantage of this??
What will happen if I use my own exceptions to handle System Exceptions( like SQl Exceptions ) instead of throwing EJBException to the container? I am using Stateless Session Bean for my application.

Thanking you.


Senthoorkumaran Punniamoorthy

Posts: 335
Nickname: senthoor
Registered: Mar, 2002

Re: Handling System Exceptions in EJB Posted: Aug 28, 2003 5:00 AM
Reply to this message Reply
This is something I copied from http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/BMP6.html.
-----------------------------------------------------------"A system exception indicates a problem with the services that support an application. Examples of these problems include the following: a database connection cannot be obtained, a SQL insert fails because the database is full, or a lookup method cannot find the desired object. If your enterprise bean encounters a system-level problem, it should throw a javax.ejb.EJBException. The container will wrap the EJBException in a RemoteException, which it passes back to the client. Because the EJBException is a subclass of the RuntimeException, you do not have to specify it in the throws clause of the method declaration. If a system exception is thrown, the EJB container might destroy the bean instance. Therefore, a system exception cannot be handled by the bean's client program; it requires intervention by a system administrator."
-----------------------------------------------------------

Fr om this what I understand is when you thorw a EJBException it raps it as RemoteException and throws back to client. So the client knows there is a problem.

Flat View: This topic has 1 reply on 1 page
Topic: Hashtable Previous Topic   Next Topic Topic: Please Help! JRE 1.4.2 Uninstall Problem

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use