Saturday, 8 September 2012

Client programs that access EJBs make use of the Java Naming and Directory Interface (JNDI). To get access to a Person entity bean, which methods can be used? (2 correct answers). | JAVA JSP

Assume the following code is used to establish the initial context:
Properties props = System.getProperties();
Context ctx = new InitialContext(props);

A. PersonHome ph = ctx.lookup(“java:comp/env/ejb/Person”);
B. PersonLocalHome ph =
(PersonLocalHome)ctx.lookup(“java:comp/env/ejb/PersonLocalHome”);
C.. PersonHome ph = ctx.lookup(“java:comp/env/ejb/PersonHome”);
D. PersonHome ph = javax.rmi.PortableRemoteObject.narrow(ctx, PersonHome.class)
E. PersonHome ph = (PersonHome)javax.rmi.PortableRemoteObject.narrow(ctx,
PersonHome.class)

Ans: B,E

No comments: