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 com.enthuware.ets.scbcd.v5.2.145 (Test 2 Q40) 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 com.enthuware.ets.scbcd.v5.2.145 (Test 2 Q40)" Watch "Enthuware com.enthuware.ets.scbcd.v5.2.145 (Test 2 Q40)" New topic

Enthuware com.enthuware.ets.scbcd.v5.2.145 (Test 2 Q40)

Ross Crockett
Ranch Hand

Joined: Aug 25, 2009
Posts: 30
Hey all,
I have some doubt over the answer to one of the drag and drop questions:

Create a valid EJB3.0 exception that is a runtime exception

public class <blank2> extends <blank3>

Options: @ApplicationException MyException RuntimeException RemoteException EJBException @EJBException

I put my answer as:
blank1 = @ApplicationException
blank2 = MyException
blank3 = EJBException

so the answer would look like:

public class MyException extends EJBException.

This is was not marked as being correct. Instead 'EJBException' should be swapped with 'RuntimeException'. Although this seems like the most obvious answer and is correct, EJBException extends RuntimeException, so doesn't that mean that MyException "is a" EJBException which "is a" RuntimeException?

The answer explanation gives:

An application exception that is an unchecked (i.e. Runtime) exception is defined as an application exception by annotating it with the ApplicationException metadata annotation, or denoting it in the deployment descriptor with the application-exception element.

Remember that EJBException extends RuntimeException but it is not an application exception because it is not annotated with @ApplicationException.

The second paragraph doesn't justify my answer from being incorrect does it, since I annotated MyException as an ApplicationException which through inheritance is a RuntimeException?
Lee Kian Giap
Ranch Hand

Joined: Jan 23, 2008
Posts: 213
EJB Core Spec 14.1.1
"application exception class may be defined as a subclass of the java.lang.RuntimeException"

as mentioned, must extends java.lang.RuntimeException .... not simply extends any runtime exception.

I agree. Here's the link:
subject: Enthuware com.enthuware.ets.scbcd.v5.2.145 (Test 2 Q40)
It's not a secret anymore!