aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Application Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Application Exception" Watch "Application Exception" New topic
Author

Application Exception

nitin pai
Ranch Hand

Joined: May 30, 2006
Posts: 185
Can an application exception extend from javax.ejb.EJBException class?



Aditya Vasudeva
Ranch Hand

Joined: May 27, 2008
Posts: 76
an EJBException is a system Exception which is a subclass of RuntimeException. all EJBExceptions are system based exceptions and hence application exceptions cannot extend them. An application exception can become a system exception if you dont annotate it with @ApplicationException.
Nikhil Jain
Ranch Hand

Joined: May 15, 2005
Posts: 385
I think yes, Application Exception are those that extend exception. System exceptions are also application exception if they are annoated with @ApplicationException. System exceptions are nothing but something that extends runtime Exception. EJB Exception extends Runtime Exception. So I think you could extend EJBException & annotate with @AppException.

Can someone confirm this.

@ApplicationException
Public MyException extends EJBException {
}


SCJP 1.4, SCWCD 1.4, SCBCD 1.5
Aditya Vasudeva
Ranch Hand

Joined: May 27, 2008
Posts: 76
its difficult to say this will work or not because nothing as such is mentioned in the specs...you can test it to find out...most probably it will not work.
nitin pai
Ranch Hand

Joined: May 30, 2006
Posts: 185
In my opinion it should be yes, since Application exceptions can extend RuntimeException and EJBException is also a subclass of RuntimeException.

However I want to confirm it since it is not mentioned in the specs and there was a similar question in the Enthuware mocks. But trying out won't give a clear answer since vendor implementations differ.

If it has not been mentioned in the specs then I hope it won't be asked in the exam too, because we don't have a clear answer for it.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Application Exception