• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

mock question

 
Prashant Neginahal
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which of the following methods will cause an IllegalStateException when used from within the message-driven bean onMessage() method? [Check all correct answers]


1)getEJBHome()
2)getRollbackOnly()
3)getUserTransaction()
4)isCallerInRole()
5)getCallerPrincipal()

Correct answers given are 1, 4 and 5.

But if you see API for EJBContext interface, this exception is NOT specified in throws clause for isCallerInRole() and getCallerPrincipal() methods.
Comments please.

Thanks,
Prashant
 
Lahiru Abeydeera
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
javax.ejb.IlleglStateException is a unchecked exception. (So you dont have to declare it in a throws clause explicitly). This exception is thrown when you call a method of the EJBContext interface where you dont have access to the method you called. Eg. Calling getRollBackOnly() from a BMT MDB.

If you need further clarification and u r in reach of HFEJB read the exceptions chapter which will make it clear to u.

Best of Luck

Lahiru Abeydeera
www.lordhiru.tk
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic