This is the way I call the test method from EJB:
public class Jndi {
public static void main(String[] args) throws NamingException,
AppException, RemoteException {
final Hashtable jndiProperties = new Hashtable();
jndiProperties.put(Context.URL_PKG_PREFIXES,
"org.jboss.ejb.client.naming");
jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jboss.naming.remote.client.InitialContextFactory");
jndiProperties.put(Context.PROVIDER_URL, "remote://localhost:4447");
jndiProperties.put(Context.SECURITY_PRINCIPAL, "capone");
jndiProperties.put(Context.SECURITY_CREDENTIALS, "1234564");
jndiProperties.put("jboss.naming.client.ejb.context", true);
final Context context = new InitialContext(jndiProperties);
final String appName = "capone";
final String moduleName = "capone-EJB";
final String distinctName = "";
final String beanName = "TestControllerBean";
final String viewClassName = TestControllerRemote.class.getName();
String lookup = "ejb:" + appName + "/" + moduleName + "/"
+ distinctName + "/" + beanName + "!" + viewClassName;
System.out.println("lookup name: " + lookup);
TestController facade = (TestController) context.lookup(lookup);
System.out.println(facade);
System.out.println("test: " + facade.testMessage("hello"));
}
}