I'm trying to build a pre-made project on my machine so I can understand a bit more about EA and EJB.
I have deployed the EA Application on the glassfish along with the required libraries. But when I try to connect my client application through JNDI, it gets stuck in the lookup (shows no errors, just gets stuck).
Will any additional configuration be required on the glassfish server?
The glassfish server is in an ubuntu server virtual machine, while the client is in another virtual machine (running on netbeans).
Is something wrong with my code?
public static void getRefs(){
InitialContext ctx = null;
Properties prop = new Properties();
prop.setProperty("java.naming.factory.initial",
"com.sun.enterprise.naming.SerialInitContextFactory");
prop.setProperty("java.naming.factory.url.pkgs",
"com.sun.enterprise.naming");
prop.setProperty("java.naming.factory.state",
"com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
prop.setProperty("org.omg.CORBA.ORBInitialHost","192.168.56.175");
prop.setProperty("org.omg.CORBA.ORBInitialPort","3700");
try {
ctx = new InitialContext(prop);
}
catch(NamingException e){
System.out.println(e.getMessage());
System.exit(1);
}
System.out.println("InitialContext Created");
String advremote =
"java:global/adv-ea/adv-ea-ejb/AdvClient!advgame.AdvClientRemote";
try{
System.out.println("Start lookup");
Object x = ctx.lookup(advremote);
gw = (AdvClientRemote)x;
}
catch (NamingException e){
System.out.println(e.getMessage());
e.printStackTrace();
System.exit(1);
}
System.out.println("JNDI lookup concluded");
}
EDIT: Can this happen because a library is missing? I'll put here an image of the project schema, just to make sure I didn't miss something:
Another Edit: It works on localhost:39002, so the problem should be on connection/port.