title: RMI program Rebind error
body: <p>I have a big problem with my code it seems. I get this :</p>
  
  <pre><code>java.rmi.ConnectException: Connection refused to host: 5.12.78.59; nested exception is: 
      java.net.ConnectException: Connection refused: connect
      at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:619)
      at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:216)
      at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:202)
      at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:340)
      at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
      at java.rmi.Naming.rebind(Naming.java:177)
      at Server.main(Server.java:9)
  Caused by: java.net.ConnectException: Connection refused: connect
      at java.net.DualStackPlainSocketImpl.connect0(Native Method)
      at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
      at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
      at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
      at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
      at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
      at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
      at java.net.Socket.connect(Socket.java:579)
      at java.net.Socket.connect(Socket.java:528)
      at java.net.Socket.&lt;init&gt;(Socket.java:425)
      at java.net.Socket.&lt;init&gt;(Socket.java:208)
      at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:40)
      at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:146)
      at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:613)
      at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:216)
      at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:202)
      at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:340)
      at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
      at java.rmi.Naming.rebind(Naming.java:177)
      at Server.main(Server.java:9)
      at __SHELL7.run(__SHELL7.java:6)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at bluej.runtime.ExecServer$3.run(ExecServer.java:725)
  </code></pre>
  
  <p>on the code below:  </p>
  
  <pre><code>public class Server {
    public static void main(String[] args) throws Exception {
  
      Generator Ob = new Generator();
      System.out.println("1");
      Naming.rebind("rmi:///Ob",Ob);
  
      System.out.println("Serverul s-a legat la" +
                         " registrul RMI");
    }
  }
  </code></pre>
  
  <p>Generator is defined correctly yet when i do Naming.rebind it all falls apart , why ? Thank you for your help.</p>