The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes how to tell application exception  from system exception  Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » Architect Certification (SCEA/OCMJEA)
Reply Bookmark "how to tell application exception  from system exception  " Watch "how to tell application exception  from system exception  " New topic
Author

how to tell application exception from system exception

Timber Lee
Ranch Hand

Joined: Oct 14, 2002
Posts: 157
When a call is made to a single-entity find method in an entity bean, the ObjectNotFoundException is thrown because the requested entity was not found,It is not automatically rolled back because it is an application exception , instead of system exception .
my question is how to tell application exception from system exception ?


SCJP<br />SCWCD<br />SCEA
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
For these types of questions it is always best to look to the EJB Specification for the answer. It has the following to say about Application Exceptions:
From Section 18.1.1 of the EJB 2.0 Specification
An application exception class must be a subclass (direct or indirect) of java.lang.Exception. An application exception class must not be defined as a subclass of the java.lang.RuntimeException or of the java.rmi.RemoteException.

Therefore, a System Exception is a RuntimeException, RemoteException, or subclass of either. An Application Exception is anything else.
CreateException, RemoveException, FinderException, and ObjectNotFoundException are all Application Exceptions. EJBException is a System Exception.
BTW, this is getting too detailed for the SCEA exam.
[ February 09, 2003: Message edited by: Chris Mathews ]
 
 
subject: how to tell application exception from system exception
 
Threads others viewed
Exception from ejbStore
Exception question
How to distinguish System exception and application exception?
How to catch exception thrown from ejbStore
when ObjectNotFoundException happens? when NoSuchEntityException happens?
IntelliJ Java IDE