Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Application Exceptions in EJB

 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How come the specs define the javax.ejb.CreateException, javax.ejb.RemoveException, javax.ejb.FinderException,
and subclasses as Application Exceptions?
 
Ralph Jaus
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
core spec 14.1.1 says:
An application exception may be a subclass of java.lang.Exception ...
All exceptions you mentioned are direct subclasses of java.lang.Exception and are therefore application exceptions.
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A RemoteException is also an Exception but the Spec says they are System Exceptions??
 
Ralph Jaus
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A RemoteException is also an Exception but the Spec says they are System Exceptions??
No that isn't true in this generality (see again 14.1.1, just read the quoted sentence to end). Runtime exceptions that are annotated with @ApplicationException (or declared correspondingly in the deployment descriptor) are application exceptions. All in all it is:

1. application exceptions are:

- checked exceptions (with exception of java.rmi.RemoteException and its subclasses)
- runtime exceptions annotated with @ApplicationException (or defined correspondingly in deployment descriptor)

2. system exceptions are: all exceptions, that aren't application exceptions; in full:

- runtime exceptions that are not declared as application exceptions
- java.rmi.RemoteException and its subclasses.


javax.ejbCreateException, javax.ejb.RemoveException and javax.ejb.FinderException are

- direct subclasses of java.lang.Exception, so they are checked exception
- distinct from java.rmi.RemoteException

Consequently they are application exceptions.
 
Arun Kumar Gupta
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good explanation Ralph cleared my doubt as well
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ralph Jaus:
No that isn't true in this generality (see again 14.1.1, just read the quoted sentence to end). Runtime exceptions that are annotated with @ApplicationException (or declared correspondingly in the deployment descriptor) are application exceptions. All in all it is:

1. application exceptions are:

- checked exceptions (with exception of java.rmi.RemoteException and its subclasses)
- runtime exceptions annotated with @ApplicationException (or defined correspondingly in deployment descriptor)

2. system exceptions are: all exceptions, that aren't application exceptions; in full:

- runtime exceptions that are not declared as application exceptions
- java.rmi.RemoteException and its subclasses.


javax.ejbCreateException, javax.ejb.RemoveException and javax.ejb.FinderException are

- direct subclasses of java.lang.Exception, so they are checked exception
- distinct from java.rmi.RemoteException

Consequently they are application exceptions.


Thanks for the explanation.
 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Coincidently,read the exception part in ejb3.0 in action today, and happend to fine such a good read.Thanks!
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which chapter is that which talks about Exceptions in the EJB 3.0 in Action book?
 
Chaminda Amarasinghe
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joth,
I strongly recommend you the spec for exceptions, transaction, security, and overview (responsibilities of roles).
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Chaminda Amarasinghe:
Joth,
I strongly recommend you the spec for exceptions, transaction, security, and overview (responsibilities of roles).


I was considering to do that. Thanks!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic