package grahamsprojclient.main; import grahamsprojserver.session.delegate.GrahamsProjBean; import grahamsprojserver.session.interfaces.GrahamsProjBeanRemote; import java.util.Hashtable; import java.util.Properties; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author gbaldeck */ public class Start { /** * @param args the command line arguments */ public static void main(String[] args) throws Exception { testItAll(); } private static void testItAll() throws NamingException { System.out.println("Testing has begun!!!"); GrahamsProjBeanRemote testMe = connectToStatelessBean(); testMe.test(); } private static GrahamsProjBeanRemote connectToStatelessBean() throws NamingException { Properties jndiProperties = new Properties(); jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming"); jndiProperties.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory"); jndiProperties.put(javax.naming.Context.PROVIDER_URL, "remote://localhost:4447"); jndiProperties.put(javax.naming.Context.SECURITY_PRINCIPAL, "userA"); jndiProperties.put(javax.naming.Context.SECURITY_CREDENTIALS, "airit"); final Context context = new InitialContext(jndiProperties); final String appName = "GrahamsProjServer"; final String moduleName = "GrahamsProjServer"; final String distinctName = ""; final String beanName = GrahamsProjBean.class.getSimpleName(); final String viewClassName = GrahamsProjBeanRemote.class.getName(); System.out.println("ejb:"+appName+"/"+moduleName+"/"+distinctName+"/"+beanName+"!"+viewClassName); return (GrahamsProjBeanRemote) context.lookup("ejb:"+appName+"/"+moduleName+"/"+distinctName+"/"+beanName+"!"+viewClassName); } }