import java.util.*;
import javax.naming.*;

public class HelloWorldClient{
	public static void main(String args[]){
		Properties pro	=	new Properties();
		pro.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
		pro.put(Context.PROVIDER_URL,"t3://localhost:7001");
		try{
			System.out.println("Before lookup");
			Context conx	=	new InitialContext(pro);
			Object obj	=	conx.lookup("HelloWorldBean");
			System.out.println("After lookup");
			HelloWorldHome	home	=	(HelloWorldHome)javax.rmi.PortableRemoteObject.narrow(obj,HelloWorldHome.class);
			System.out.println("Before create");
			HelloWorld hello	=	home.create();
			System.out.println("After create");
			hello.sayHello();
			System.out.println("After say hello");
			//
			hello.remove();
		}catch(Exception ex){
			ex.printStackTrace();
		}

	}
}