• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

a mock question

 
chao cai
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
13. Given the following onMessage() method of a message-driven bean (Assume that all necessary imports have been made, that Bean is the component interface type of a stateless session bean and BeanHome is its home interface):
public void onMessage(javax.jms.Message msg) {
Context initCtx = new InitialContext();
Object result = initCtx.lookup("java:comp/env/ejb/Bean");
BeanHome beanHome = (BeanHome) PortableRemoteObject.narrow(result,
BeanHome.class);
//do something with beanHome.
}
Select all the correct statements:
A. The code will not compile. The onMessage() method if a message-driven bean may throw any application exception.
B. The code compiles fines.
C. The code should be enclosed in a try-catch block.
D. The onMessage() method declaration does not satisfy the requirements of the EJB 2.0 specification.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic