• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Error while registring the server object to RMI registry

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

One RMI program is giving me following error while registring the server ojbect to the rmi registry.

Can anybody help me out.

---------- New Program run ----------
object instatiatedHelloServer[UnicastServerRef [liveRef: [endpoint:[10.12.46.245:4780](local),objID:[0]]]]
Connection refused to host: 10.12.46.245; nested exception is:
java.net.ConnectException: Connection refused: connect

Thanks in advance.
 
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Looks like a either a firewall is preventing access to the IP address at the required port or the RMI registry isn't running.
 
Prakash Chauhan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
By keeping firewall turnoff same problem is coming. How do i come to know that RMI registry is not running ? I am registring the server object to the RMI registry using the following method.

Naming.rebind("HelloServer",obj);

Have a look at my program too.

import java.rmi.*;
import java.rmi.server.*;
import java.util.*;

interface HelloInterface extends Remote {
public String sayHello( ) throws RemoteException ;
}

class HelloServer extends UnicastRemoteObject implements HelloInterface{
public HelloServer( ) throws RemoteException {
super( );
}

public String sayHello( ) throws RemoteException {
return "Hello world, the current system time is" +new Date( );
}
}


public class RegisterIt {
public static void main(String [ ] args) {
try
{
HelloServer obj = new HelloServer( );
System.out.println("object instatiated" +obj);
Naming.rebind("HelloServer",obj);
System.out.println("Hello server bound in registry");
}

catch (Exception e)
{
System.out.println(e);
}
}
}
 
Jeroen T Wenting
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
if you don't start it (and no other program starts it for you), it's not running.
 
Prakash Chauhan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Jeroen

I got the mistake. I have not opened the rmi registry.

by commpiling all class &
using following command

rmic HelloServer
start rmiregistry
java RegisterIt
java HelloClient

I am getting the result. Thanks once again.
 
I'm gonna teach you a lesson! Start by looking at this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic