2 Replies Latest reply on Dec 30, 2005 10:03 AM by 843793

    Problem with RMI Stub!!!

    843793
      Hi All,

      I have a jar which has some classes along with stub in it. I am including that jar in to

      classpath and calling rmiregistry. When I start my program I get the following exception

      java.rmi.ConnectException: Connection refused to host: mercury; nested exception is:
           java.net.ConnectException: Connection refused: connect
           at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:567)
           at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
           at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
           at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:313)
           at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
           at java.rmi.Naming.rebind(Naming.java:160)

      Caused by: java.net.ConnectException: Connection refused: connect
           at java.net.PlainSocketImpl.socketConnect(Native Method)
           at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
           at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
           at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
           at java.net.Socket.connect(Socket.java:452)
           at java.net.Socket.connect(Socket.java:402)
           at java.net.Socket.<init>(Socket.java:309)
           at java.net.Socket.<init>(Socket.java:124)
           at

      sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
           at

      sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
           at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:562)
           ... 7 more

      I think rmiregistry is unable to make that stub avaliable for my program, can anyone please

      help me to solve my problem.

      Cheers,
      Kumar
        • 1. Re: Problem with RMI Stub!!!
          843793
          Hi Everyone,

          All the code I have written is not useful as I am unable to use the jar produced out of it because of my problem. I have to make avaliable the stub in jar to RmiRegistry. Can anyone please help me.

          Thanks,
          Kumar.
          • 2. Re: Problem with RMI Stub!!!
            843793
            Thats because its not able to locate RMI Registry to bind itself.
            If you want to use JAR file, its better to use RMIRegistry as an embedded service. You can do this by follwing,
            Include LocateRegistry.createRegistry(1099); in your server program before binding your remote object.
            Need not to run RMIRegistry service explicitly.
            - Rajesh