aspose file tools*
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
Author

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

Ross Crockett
Greenhorn

Joined: Aug 25, 2009
Posts: 28
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

<blank1>
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:

@ApplicationException
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: 210
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.


SCJP 6, SCWCD 5, SCBCD 5
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Enthuware com.enthuware.ets.scbcd.v5.2.145 (Test 2 Q40)
 
Similar Threads
How to define a ApplicationException
Application Exception
Enthuware Question doubt
question on EJB 3 IN ACTION - application exception rollback
Extending EJB Exception