File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Enthuware error test 1 Q23 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 "Enthuware error test 1 Q23" Watch "Enthuware error test 1 Q23" New topic

Enthuware error test 1 Q23

Yucca Nel
Ranch Hand

Joined: Nov 20, 2008
Posts: 147

A MDB can not throw a checked exception right? IOException is checked so can it be thrown by MDB?

SCJP 6.0, SCJD (400/400), SCBCD for JEE 5, SCWCD 1.4 I do videos for development at
I am probably the only developer ever to have had an orange sized brain tumor in my brain while learning development!!
Deepika Joshi
Ranch Hand

Joined: Feb 24, 2009
Posts: 268
1. EJB spec does not allow I/O operation, so IOException is out of question.
2. If a X(system/ checked)X exception is thrown, container destroy the MDB bean instance, assuming (MDB) bean instance is not consistent.

- X(system/ checked)X : I am not able to recollect completely at the moment, please check the document/book.
Yucca Nel
Ranch Hand

Joined: Nov 20, 2008
Posts: 147

Yes you are right that it does not allow IO operation(the spec) but that does not mean you can not throw your own IOException. The IOException is in fact allowed in netbeans and no compile error is shown. However the rules of overriding interfaces are applied so if one overrides MessgaListener.onMessage() you can not throw IOException.
I agree. Here's the link:
subject: Enthuware error test 1 Q23
It's not a secret anymore!