Help coderanch get a
new server
by contributing to the fundraiser
  • 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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.
 
This tiny ad is wafer thin:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic