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:"

I've already turned off all firewalls and configured RMI on the router. Also when running the server, I configured the host name.

Code: Select all
 //set the security manager
           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 ( me)
            System.out.println("Malformed URL: " + me.toString());

       catch (RemoteException re)
            System.out.println("Remote exception: " + re.toString());


Code: Select all
                      System.out.println("Security Manager loaded");
                      String url = "//";
                      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);
                        JOptionPane.showMessageDialog(jContentPane, "wrong", "Login",2);

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 but the error message is about Is there any problem?

P.S. you probably don't need a security manager on the server.
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 1 guest