Appel EJB à distance : Connection timed out
Bonjour,
Je travaille sur une application J2EE avec des EJB 2.1.
Mon application fonctionne en local mais pas à distance (l'application serveur et cliente sont sur deux serveurs différentes).
J'ai une erreur :
Connection refused to host: 172.22.51.9; nested exception is: java.net.ConnectException: Connection timed out: connectjava.net.ConnectException: Connection timed out: connect
à ce moment là :
home.create();
Je ne vois vraiment pas d'où cela peut venir.
Voici mon code pour appeler l'ejb :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
public static Authentification createAuthentification() throws RemoteException {
try {
Context ctx = getInitialContext();
Object obj = ctx.lookup("AuthentificationHome");
AuthentificationHome home = (AuthentificationHome) PortableRemoteObject.narrow(obj, AuthentificationHome.class);
return home.create();
} catch (NamingException ne) {
throw new RemoteException("Problème de nommage de l'EJB Authentification : " + ne.getMessage());
} catch (CreateException ce) {
throw new RemoteException("Problème lors de la création de l'EJB : " + ce.getMessage());
} catch (RemoteException re) {
throw new RemoteException("Problème de connexion à l'EJB : " + re.getMessage() + re.getCause());
}
}
static protected Context getInitialContext() throws NamingException {
String url = "rmi://localhost:2224";
try {
// Get an InitialContext
Properties h = new Properties();
h.put(Context.INITIAL_CONTEXT_FACTORY, "org.objectweb.carol.jndi.spi.MultiOrbInitialContextFactory");
h.put(Context.PROVIDER_URL, url);
return new InitialContext(h);
} catch (NamingException ne) {
ne.printStackTrace();
throw ne;
}
} |
Petite remarque :
j'apelle rmi://localhost:2224 car j'ai un tunnel entre le port 2224 de ma machine vers le port 1198 du serveur où sont mes ejbs (jonas est configuré avec un port rmi jrmp = localhost:1198).
J'ai fait cela car je ne suis pas sur d'avoir les autorisations reseau sur le port 1198 du serveur. Le tunnel marche à priori sans souci.
Est ce normal que home soit egal à :
JOnASauthentification_260367359Home_Stub[JUnicastRef [liveRef: [endpoint:[172.22.51.9:22336](remote),objID:[1a9334:12650189555:-7fff, 18]]]]
Le port 22336 est il normal ? d'ou sort il ? J'ai remarqué qu'il changait à chaque redemarrage de jonas. Le client doit il avoir accès à ce port ?
Merci beaucoup pour votre aide, car là je ne sais plus où chercher...
Sylvain.