package testclient;

import javax.naming.InitialContext;

import juno2Beans.sellPositions.CmdSellPosition;
import juno2Beans.sellPositions.CmdSellPositionHome;

/**
 * @author yashtalwar
 *
 * To change this generated comment edit the template variable "typecomment":
 * Window>Preferences>Java>Templates.
 * To enable and disable the creation of type comments go to
 * Window>Preferences>Java>Code Generation.
 */
public class TestClient {

	public static void main(String[] args) {
		
		CmdSellPositionHome ejbHome 	= null;
		CmdSellPosition	   ejb		= null;
		
		//The logic of this servlet is putting text message to JMS queue
		try {
			System.out.println("I am here");
			InitialContext initCtx = new InitialContext();

// Lookup for EJB Home reference object and then narrow (cast) it to EJB Home
			ejbHome = (CmdSellPositionHome) javax.rmi.PortableRemoteObject.narrow(initCtx.lookup("ejb/CmdSellPosition"), CmdSellPositionHome.class);
			
		} catch (Exception ex) {
			System.out.println(" Could not lookup EJB Home object");
			ex.printStackTrace();
		}
		
		try {
			ejb = ejbHome.create();
		
		}	catch (Exception ex){
				System.out.println("Could not create ejb");
				ex.printStackTrace();
			}
			
		}
	}

