I've already turned off all firewalls and configured RMI on the router. Also when running the server, I configured the host name.
server:
- Code: Select all
//set the security manager
try
{
System.setSecurityManager(new RMISecurityManager());
//create a local instance of the object
LoginImpl Server = new LoginImpl();
//put the local instance in the registry
Naming.rebind("SERVER" , Server);
System.out.println("Server waiting.....");
}
catch (java.net.MalformedURLException me)
{
System.out.println("Malformed URL: " + me.toString());
}
catch (RemoteException re)
{
System.out.println("Remote exception: " + re.toString());
}
}
client
- Code: Select all
try
{
System.out.println("Security Manager loaded");
String url = "//192.168.0.5/SERVER";
Login remoteObject = (Login)Naming.lookup(url);
System.out.println("Connection established");
//narrow the object down to a specific one
//System.out.println("Location: " + System.getProperty("LOCATION"));
// make the invocati
if(remoteObject.login(jTextUsuario.getText(), jPasswordField.getText())){
JOptionPane.showMessageDialog(jContentPane, "Logged", "Login",3);
}else{
JOptionPane.showMessageDialog(jContentPane, "wrong", "Login",2);
}
}