SessClient.java :  » J2EE » JOnAS-4.8.6 » samplehttp » beans » Java Open Source

Java Open Source » J2EE » JOnAS 4.8.6 
JOnAS 4.8.6 » samplehttp » beans » SessClient.java
// SessClient.java
// mini Client for accessing bean Sess

package samplehttp.beans;

import java.rmi.RemoteException;
import java.util.Collection;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.rmi.PortableRemoteObject;

/**
 *
 */
public class SessClient {

    static Context ctx = null; 
    static SessHome home = null;

    public static void main(String[] arg) {

  // Get InitialContext
  try {
      ctx = new InitialContext();
  } catch (NamingException e) {
      e.printStackTrace();
      System.exit(2);
  }

  // Lookup bean home 
  String bName = "sessSessSLRHome";
  try {
      home = (SessHome) PortableRemoteObject.narrow(ctx.lookup(bName), SessHome.class);
  } catch(Exception e) {
      e.printStackTrace();
      System.exit(2);
  }

  // ...
    }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.