I strongly disagree.

Here is my opinion on the seperation of application level exceptions and
system level exceptions.  Both of which are thrown from the container either
to another bean or directly to the client.

A system level exception such as java.rmi.RemoteException or
javax.ejb.EJBException are the EJB equivilent of a windows GPF.  They
represent an intrinsic system level failure which was not predicted by the
developer or for which there is no non-systemic solution.  For instance, the
database is no longer responding, or, a RuntimeException.  The container
assumes on generation of a system level exception that the bean has entered
into an inconsistant state (for stateful session beans) and hence 1) the
client should be notified, 2) the tx is possibly doomed (too complex for
this email thread) and 3) that the bean instance should be completely
destroyed.  The container destroys the instance, again because it assumes
the system level exception is a sign of a problem with no non-systemic
solution.  This is why I say this is analagous to a GPF or core dump.

An application level exception is used to 1) notify your client of an
application specific error that should 2) stop execution of the work being
performed.  For instance, attempting to remove an item from the shelf, when
the shelf is empty.  There are non-systemic solutions to this problem.  For
instance, you can prompt the user to look on another shelf.  There is no
need to doom the tx, or destroy the object when this occurs.

There was another thread Gene and I had on this last week.  This is why I
wrap all my calls inside a larger try/catch block.  In my code block I will
catch all exceptions I feel may occur and which I can solve.  I then wrap
the entire call in another try/catch block catching the top level Exception
class.  This exception terminates my block and has no solution, causing me
to throw the application level exception, this notifying the container to
destroy my instance.

Hope this helps some.

Dave Wolf
Internet Applications Division
Sybase


> -----Original Message-----
> From: A mailing list for Enterprise JavaBeans development
> [mailto:[EMAIL PROTECTED]]On Behalf Of Mangtani Komal
> Sent: Monday, September 18, 2000 11:12 AM
> To: [EMAIL PROTECTED]
> Subject: Re: System vs. Application Exception
>
>
> IMHO, Application exception is the one which the client program ( the one
> which does lookup for ejbhome..)throws.
> System exception is thrown by your EJB Server which includes all the
> exceptions thrown by your entity/sessionbeans.
> Rgds.,
> Komal.
>
>
>
>
>                     Jeff Sahol
>                     <[EMAIL PROTECTED]        To:
> [EMAIL PROTECTED]
>                     >                        cc:
>                     Sent by: A               Subject:     System
> vs. Application Exception
>                     mailing list for
>                     Enterprise
>                     JavaBeans
>                     development
>                     <EJB-INTEREST@JAV
>                     A.SUN.COM>
>
>
>                     09/18/00 09:27 AM
>                     Please respond to
>                     A mailing list
>                     for Enterprise
>                     JavaBeans
>                     development
>
>
>
>
>
> The Developer's Guide says that "If a system exception is thrown, the
> EJB
> container might destroy the bean instance." It gives some examples of
> system exceptions, but no general rule as to what exceptions should be
> considered "system exceptions." Does anyone know?
>
> Reason I ask is that I plan to rethrow exceptions from the EJB and don't
> want some unanticipated error to end up destroying EJB's, at least not
> without my knowledge.
>
> --
> Jeff Sahol
> [EMAIL PROTECTED]
>
> ==================================================================
> =========
> To unsubscribe, send email to [EMAIL PROTECTED] and include
> in the body
> of the message "signoff EJB-INTEREST".  For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
>
> ==================================================================
> =========
> To unsubscribe, send email to [EMAIL PROTECTED] and include
> in the body
> of the message "signoff EJB-INTEREST".  For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
>
>

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to