aspose file tools
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Resource manager access Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » EJB Certification (SCBCD/OCPJBCD)
Reply Bookmark "Resource manager access" Watch "Resource manager access" New topic
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
 
Threads others viewed
ETS Question doubts
Sample questions on J2EE ????
ICE 287 answers for WebSphere 5.0
ETS Question doubt stateless bean
Nice EJB Questions. Any Takers?
MyEclipse, The Clear Choice