I m trying to create hello world example using rmi but till not succeeded.I got error in server file "Server Error java.rmi.ConnectException: Connection refused to host: 192.168.1.5; nested exception is: So please help me out.

public class Server implements Hello
{

    public String sayHello()
    {
      return "Hello World!";
    }

     public static void main(String arg[])
    {
         try
         {
             Server obj = new Server();
             Hello stub = (Hello)UnicastRemoteObject.exportObject(obj,0);

             Registry  registry = LocateRegistry.getRegistry();
             registry.bind("Hello",stub);

             System.err.println("Server Ready");
         }
         catch(Exception e)
         {
             System.err.println("Server Error:"+e.toString());
         }

     }

}

Post the entire stacktrace. Also, which tutorial are you referencing when writing your RMI programs? Do you have sufficient permissions to bind to the port 1099 (default rmiregistry port)?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.