PersonClient.javaAPI DocExample1416Wed Apr 05 11:25:42 BST 2000None


public class PersonClient extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

    String name = args[0];

    try {
      // Get a JNDI context for our EJB server (EJBHome, in this case)
      Properties p = new Properties();
      // Add URL, host or port options, if needed...;
      Context context = new InitialContext(p);

      // Get the home interface for Person beans
      PersonHome pHome =

      // Create a named person
      Person person = pHome.create(name);

      // Use the remote stub interface to access the person’s data
      // . . .
    catch (NoSuchPersonException nspe) {
      System.out.println("Invalid person: " + name);
    catch (Exception e) {
      System.out.println("Error while creating/using person.");