| Author |
Resource manager access
|
Diana Finis
Greenhorn
Joined: Jan 27, 2003
Posts: 11
|
|
Hi all, Recently I was going through some mock exam and faced the following question: ---------------------------------------------------- "Consider the following method of a stateless session bean. Which of the given options are correct regarding this method?" Code : public xxxx() throws { try { InitialContext ctx = new InitialContext(); QueueConnectionFactory queueConnectionFactory = (QueueConnectionFactory) ctx.lookup("java:comp/env/jms/myQueueConnectionFactory"); ...//other valid code. } catch(Exception e) { throw new EJBException(e.getMessage()); } } Options : Select 1 correct option. 1. It may be ejbCreate() method. 2. It may be ejbRemove() method. 3. It may be a business method. 4. It may be setSessionContext() method. 5. This code is invalid in any stateless session bean method. ---------------------------------------------------- The correct answer was "3. It may be a business method." For me it doesn't look rigth. Resource Manager is registered via resource-ref tag, hence it's available in "java:/comp/env" scope. And JNDI access to "java:/comp/env" IS ALLOWED for all methods listed above. Can somebody clarify this point to me? Thanks in advance. Diana
|
Diana<p>--------<br />SCJP<br />SCWD<br />Passed IBM Portal Multiplatform Implementation
|
 |
hover cheng
Ranch Hand
Joined: Feb 11, 2003
Posts: 66
|
|
Hi, Diana In chapter "7.8.2 Operations allowed in the methods of a stateless session bean class" of EJB spec 2.0, it has a clear restriction on which methods could be accessed regarding EJBContext, Transaction, JNDI and resource manager. Comparing with that, the 3rd answer is quite right. Regards,
|
SCJP 91% SCJD 94% SCBCD 98% SCWCD1.4 86%<p>XML141 SCDWJS -- in progress<br />If you don't retreat, you are mostly among those who can surmount it.
|
 |
 |
|
|
subject: Resource manager access
|
|
|