• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

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

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Grow your own food... or this tiny ad:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic