jQuery in Action, 2nd edition*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes RuntimeException treated as application exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "RuntimeException treated as application exception" Watch "RuntimeException treated as application exception" New topic
Author

RuntimeException treated as application exception

Dumitru Postoronca
Ranch Hand

Joined: May 06, 2008
Posts: 46
Hello,

I am calling an EJB that throws a RuntimeException which gets re-thrown exactly as is to the client.



The code outputs 'Exception in thread "main" java.lang.RuntimeException at ses.MyOtherSes.methodThrowsSystemEx(MyOtherSes.java:23)'.
I'm using jboss 5.1GA.

I don't have an ejb-jar.xml file and i haven't specified RuntimeException to be an application exception. I do NOT understand why it throws it as is instead of throwing an EJBException.

Thank you.
Joe carco
Ranch Hand

Joined: Apr 14, 2009
Posts: 82
that is rather strange, I tried that on Glassfish 3.1, a client with main method calling a remote SLSB that throws a RuntimeException in its business method. The client gets an EJBException ... caused by RemoteException
Dumitru Postoronca
Ranch Hand

Joined: May 06, 2008
Posts: 46
I have created a new class & new client and this time I get the expected EJBException.
No idea what happened before.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: RuntimeException treated as application exception