which code correctly acquires a reference to HelloBean?

A developer writes a stateless session bean HelloBean that exposes a local business interface
Hello:

The developer wants to test HelloBean using the EJB 3.1 Embeddable API. Given a main method
with the following code:
100. EJBContainer container = EJBContainer.createEJBContainer();
Assuming HelloBean is packaged in hello.jar and included in the classpath, which code correctly
acquires a reference to HelloBean?

A developer writes a stateless session bean HelloBean that exposes a local business interface
Hello:

The developer wants to test HelloBean using the EJB 3.1 Embeddable API. Given a main method
with the following code:
100. EJBContainer container = EJBContainer.createEJBContainer();
Assuming HelloBean is packaged in hello.jar and included in the classpath, which code correctly
acquires a reference to HelloBean?

A.
InitialContext ic = new InitialContext();
Hello h = (Hello) ic.lookup(�java:global/hello/HelloBean�);

B.
InitialContext ic = new InitialContext();
Hello h = (Hello) ic.lookup(�com.acme.Hello�);

C.
Context c = container.getContext();
Hello h = (Hello) ic.lookup(�com.acme.Hello�);

D.
Context c = container.getContext();
Hello h = (Hello) ic.lookup(�java:global/hello/HelloBean�);

Explanation:
You can initialize the InitialContext class to obtain a context, that can further be
used to perform the lookup.



Leave a Reply 1

Your email address will not be published. Required fields are marked *