The client can access the business interface directly and can call the methods of the bean directly.
package org.objectweb.easybeans.tutorial.helloworld;
import javax.naming.Context;
import javax.naming.InitialContext;
/**
* Client of the helloworld bean.
* @author Florent Benoit
*/
public final class Client {
/**
* JNDI name of the bean.
*/
private static final String JNDI_NAME =
"org.objectweb.easybeans.tutorial.helloworld.HelloWorldBean"
+ "_" + HelloWorldInterface.class.getName() + "@Remote"
/**
* Utility class. No public constructor
*/
private Client() {
}
/**
* Main method.
* @param args the arguments (not required)
* @throws Exception if exception is found.
*/
public static void main(final String[] args) throws Exception {
Context initialContext = new InitialContext();
HelloWorldInterface businessItf =
(HelloWorldInterface) initialContext.lookup(JNDI_NAME);
System.out.println("Calling helloWorld method...");
businessItf.helloWorld();
}
}
![]() |
Note |
|---|---|
|
The client does not call the PortableRemoteObject.narrow() method. Also, no create() method is required. |