I have a Java EE application that uses RMI to allow clients to connect to
the server application. I can start my Glassfish server, then run the
Server application (which posts the RMI classes), and have any of my client
PCs within my home network connect to the application with no problems.
However, as soon as I go off of the network, I can no longer connect to the
RMI classes. How can I make these classes available from remote
networks? I currently am using a Windows XP Home edition PC, but have just
purchased a new WHServer machine (which I am just becoming familiar with).
Must I transfer my application to the WHS machine in order to work? If so,
how do I set up Glassfish to allow remote access to the application and not
just intra-network access? If it's not necessary, how do I do it with my
Windows XP machine?
I'll give some sample code to show how I've been utilizing RMI:
Here is server code:
UserLoginImpl userLog = new UserLoginImpl();
UnicastRemoteObject.unexportObject(userLog, true);
UserLogin stub = (UserLogin) UnicastRemoteObject.exportObject(userLog, 0);
Registry registry = LocateRegistry.createRegistry(1099);
Naming.rebind("UserLogin", stub);
Here is client code:
Registry registry = LocateRegistry.getRegistry("10.10.10.105"); /* This works
locally, but obviously fails remotely. I've tried to set up a static IP
address, and utilize port forwarding, but I have not succeeded.*/
UserLogin stub = (UserLogin)registry.lookup("UserLogin");
outcome = stub.validateLogIn(loginStr, password);
--
[Message sent by forum member 'ChexWithRaisins']
View Post: http://forums.java.net/node/879030