aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Doubt on Whizlabs Mock Test Question 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 "Doubt on Whizlabs Mock Test Question" Watch "Doubt on Whizlabs Mock Test Question" New topic
Author

Doubt on Whizlabs Mock Test Question

Jisha Anand
Ranch Hand

Joined: Apr 02, 2009
Posts: 62

Hello All!

The following is a question from Whizlabs mock test:

Which of the following statement is incorrect about how the exceptions are handled in EJBs?
Choose one answer.
a. When a business method of an enterprise bean throws an application exception, the container discards that instance of the bean
b. Message driven beans are not allowed to throw application exceptions to the client.
c. When a business method of an enterprise bean throws an application exception, the container always automatically rolls back the transaction.
d. The class of the exception received by the client is the same as the class of the exception when the bean throws an application exception.


It says: Choice C is the correct answer.

Ofcourse choice C is correct; which implies the statement is wrong and all other statements are correct. But I am not sure whether the choice A is correct or not. Does the container really discard an instance of a bean if it throws application exception?

Thanks in advance!


SCJP, SCWCD, SCBCD
leonardo segala
Greenhorn

Joined: Sep 02, 2009
Posts: 26
this question seems ill-formulated, because according to Table 14 of section 14.3.1 in core spec, after applications exceptions the container don't discard instance, but any other type of exception yes.
Jisha Anand
Ranch Hand

Joined: Apr 02, 2009
Posts: 62

leonardo segala wrote:this question seems ill-formulated, because according to Table 14 of section 14.3.1 in core spec, after applications exceptions the container don't discard instance, but any other type of exception yes.


Leonardo,

I too have the same understanding. In such a case, the statement with choice A is wrong and hence the question should have both choices A, C as the answers. Am I correct?

Thanks!
Ross Crockett
Ranch Hand

Joined: Aug 25, 2009
Posts: 30
The answers to those sound a bit dodgey.

For option B) an exception wouldn't reach a client because MDB's don't have clients. Do they mean the container?

Also even for option C) which is correct, the case exists where an application exception can be marked as @ApplicationException(rollback=false). This would not cause a rollback. In fact any exception explicitly defined as so by the bean-provider using the @ApplicationException annotation defaults to rollback=false.

Perhaps they should word this question with a code sample or something to eliminate ambiguity.
Jisha Anand
Ranch Hand

Joined: Apr 02, 2009
Posts: 62

Even I feel the question has to re-worded and the choice has to be multiple!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubt on Whizlabs Mock Test Question