je n'ai jamais fait personnellement parce que je préfère utiliser les interfaces locales dans la même machine virtuelle Java car il améliore considérablement les performances.
Mais vous pouvez vérifier cela:
https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html#StandaloneRemoteEJB
Mais vous pouvez donner à ce essayer:
Properties props = new Properties();
props.setProperty("java.naming.factory.initial",
"com.sun.enterprise.naming.SerialInitContextFactory");
props.setProperty("java.naming.factory.url.pkgs",
"com.sun.enterprise.naming");
props.setProperty("java.naming.factory.state",
"com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
// optional. Defaults to localhost. Only needed if web server is running
// on a different host than the appserver
props.setProperty("org.omg.CORBA.ORBInitialHost", "ejb_server_ip_or_host_name");
// optional. Defaults to 3700. Only needed if target orb port is not 3700.
props.setProperty("org.omg.CORBA.ORBInitialPort", "3700");
InitialContext ic = new InitialContext(props);
Étape 2. Utilisez le nom JNDI global de la cible EJB à distance dans le Chercher.
3.x EJB, en supposant un nom JNDI global de "com.acme.FooRemoteBusiness":
FooRemoteBusiness foo = (FooRemoteBusiness) ic.lookup("com.acme.FooRemoteBusiness");
EJB 2.x, en supposant un nom JNDI global de "com.acme.FooHome":
Object obj = ic.lookup("com.acme.FooHome");
FooHome fooHome = (FooHome) PortableRemoteObject.narrow(obj, FooHome.class);
double possible de [Comment puis-je déployer session Bean sur un autre ordinateur avec le client JSP/Servlet] (http://stackoverflow.com/questions/3614802/how-can-i-deploy-session-bean-on -autre-ordinateur-avec-client-jsp-servlet) –
Check out - Exemple complet: http://stackoverflow.com/questions/4763960/accessing-a- apatride-ejb-d'une autre instance-de-glassfish/10194057 # 10194057 –