I have been using the Whizlabs exam simulator alongside the Enthuware Exam simulator. Enthuware's question and answers are of a pretty high quality. However the same cannot be said about Whizlabs. I am really considering not using this exam simulator any more as the questions are very vague with very poor English (I am a native speaker).
Has anyone used the Whizlabs and found it useful for the actual exam???
Joined: Nov 15, 2008
One of the questions from Whizlabs is the following (Question 53 in Exam 2):
Which of the following is incorrect about the how the exceptions are handled in EJB's (1 correct 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 exceptions to clients
C. When a business method of an enterprise bean throws an application exception, the container automatically rolls back the transaction
D. The class of exception recieved by the client is the same class of exception when the bean throws an application exception
Whizlab answer: C My answer: A and C
A bean is never discarded when an application exception is thrown as the client can try and recover as per section 14.3.1 of the EJB3 core specification. Were the exception changed to a 'system exception' "A" would not be an answer.
As far as I know, only nonapplicationexception cause the container discard the session bean and rollback the transaction. I think both the answer A and B are not right.
I prefer the answer D, as the ejb core says: "An application exception thrown by an enterprise bean instance should be reported to the client precisely", the ApplicationException are "rethrowed".
[ December 17, 2008: Message edited by: Mellon Sun ]
[ December 17, 2008: Message edited by: Mellon Sun ] [ December 18, 2008: Message edited by: Mellon Sun ]
Joined: May 17, 2006
Im really sorry.. I wanted to say "Your answer is NOT correct". but by mistake I have missed "NOT".
Mellon Sun is CORRECT. (I double checked )
Here is the summary.
By default App exceptions do not rollback the exceptions (you can override using annotations or ejb-jar). App exceptions are recoverable. So bean instance will not be discarded. To be recoverable, App exps should be propagated to client as it is, not as a wrapped.