I use xdoctlet that creates the remote and local interfaces for me. Then all i do is set the jndi context on my client i.e.
Hashtable jndiSettings = new Hashtable();
jndiSettings.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
jndiSettings.put(Context.URL_PKG_PREFIXES, "org.jboss.naming
rg.jnp.interfaces");
jndiSettings.put(Context.PROVIDER_URL, url);
and then get the home interface as I would if it were local(home):
mySession = MySessionUtil.getHome(jndiSettings).create();
In side the util class made by xdoclet I have...
public static alpha.MySessionHome getHome( java.util.Hashtable environment ) throws javax.naming.NamingException
{
// Obtain initial context
javax.naming.InitialContext initialContext = new javax.naming.InitialContext(environment);
try {
java.lang.Object objRef = initialContext.lookup(alpha.MySessionHome.JNDI_NAME);
return (alpha.MySessionHome) javax.rmi.PortableRemoteObject.narrow(objRef, alpha.MySessionHome.class);
} finally {
initialContext.close();
}
}
hope this helps