• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Jj Roberts
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Himai Minh
  • Carey Brown
  • salvin francis

Application Exceptions in EJB

 
Ranch Hand
Posts: 10192
3
Mac PPC Eclipse IDE 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?
 
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: 10192
3
Mac PPC Eclipse IDE 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.
 
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: 10192
3
Mac PPC Eclipse IDE 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.
 
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: 10192
3
Mac PPC Eclipse IDE 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?
 
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: 10192
3
Mac PPC Eclipse IDE 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!
reply
    Bookmark Topic Watch Topic
  • New Topic