Running a RMI application through network

This is the place for general discussion of the RMI plugin for Eclipse and support questions

Running a RMI application through network

Postby joacocool » Mon Oct 08, 2007 12:00 am

hi, I'm trying to run a server on one computer and attempting to run a client from another, but when I run the client it throws "java net exception: connection refused to host: 192.168.0.3"

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);

                     }
                    }
joacocool
 
Posts: 1
Joined: Sun Oct 07, 2007 11:47 pm

Postby genady » Sat Oct 20, 2007 11:00 pm

You notice the difference - you connect to 192.168.0.5 but the error message is about 192.168.0.3. Is there any problem?

P.S. you probably don't need a security manager on the server.
genady
Site Admin
 
Posts: 397
Joined: Sat Aug 16, 2003 5:15 pm


Return to General discussion and support

Who is online

Users browsing this forum: No registered users and 2 guests

cron