• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Extending EJB Exception

 
Ranch Hand
Posts: 393
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it possible to extend an exception from EJBException & still be an ApplicationException

For ex

@ApplicationExcetion
public class MyException extends EJBException{
}

Technical this should be possible as EJBException extends RuntimeException.

But in one of the mock exams the above concept seems to incorrect
 
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Anu Tilwalli,

I read in the specs (14.1.1):

An application exception may be a subclass (direct or indirect) of java.lang.Exception (i.e., a �checked exception�), or an application exception class may be defined as a subclass of the java.lang.RuntimeException (an �unchecked exception�). An application exception may not be a subclass of the java.rmi.RemoteException. The java.rmi.RemoteException and its subclasses are reserved for system exceptions.


So, I think that a subclass of EJBException annotated as ApplicationExcetion will be an application exception.

But I've just tested it with my JBoss.
I have created this Bean:

And the exception:


When it extends Exception, I don't see the destroy in the console.
--> It's an application exception

When it extends EJBException appears a "[STDOUT] Destroyed".
--> It's a system exception.


So, the theory says that you can extends EJBException but the reality shows that it's not true.

Beno�t
reply
    Bookmark Topic Watch Topic
  • New Topic