Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8754607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:39:40+00:00 2026-06-13T13:39:40+00:00

First of here is the Exception that I’m getting: https://i.stack.imgur.com/6V7ts.png Just to give little

  • 0

First of here is the Exception that I’m getting: https://i.stack.imgur.com/6V7ts.png

Just to give little background I’m trying to write simple RMI program that connects two remote computers (Client/Server) using java’s RMI. I have my Server program up and running but when I run my Client program I get the exception showed above in the link. Since I’m telling it to connect to 192.168.0.104 why is it saying “Connection refused to host: 127.0.1.1”???

Client

public class Client 
{
public static void main(String[] args)
{
ServerInterface server;     
Registry registry;

try
    {
    registry = LocateRegistry.getRegistry("192.168.0.104", (new Integer(1099)).intValue());         

    server = (ServerInterface)Naming.lookup("//192.168.0.104/ServerTest");

    String serverString = server.getAndSetMessage("Connecting");

    System.out.println("Reply from the server is: " + serverString);
    }
    catch(Exception e)
    {
        e.printStackTrace();
    System.exit(1);
    }


}
}

Server

public class Server extends UnicastRemoteObject implements ServerInterface 
{

static String hostName = "192.168.0.104";
String name;

public Server(String name) throws RemoteException
{
    super();
    this.name = name;

}

public String getAndSetMessage(String message) throws RemoteException
{
    return("My name is " + name + " Thanks for message " + message);
}

public static void main(String args[]) 
{
    try
    {
        String objectname = "ServerTest";

        Server theServer = new Server(objectname);
        Naming.rebind("//"+hostName+"/"+objectname,theServer);

        System.out.println("//"+hostName+"/"+objectname);
        System.out.println("I am Registered");

    }
    catch (Exception ex)
    {
        System.out.println(ex);
        System.exit(1);
    }

}

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T13:39:41+00:00Added an answer on June 13, 2026 at 1:39 pm

    You could try to add the following code to the server:

    System.setProperty("java.rmi.server.hostname", "192.168.0.104");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my first here in Stackoverflow. So I just want to ask question
First question here: it is a very short yet fundamental thing in Java that
I have found that my application crashes with a null reference exception right here
In one of our application im getting an exception that i can not seem
First here's what I'm using and trying to do: the minimal setup for this
First timer here, and total noob when it comes to PHP and JavaScript. I
first post here as I'm stuck with my wonderful C++ function. The error I'm
First post here... I normally develop using PHP and Symfony with Propel and ActionScript
First off here is the code! <!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd>
first post here, and probably an easy one. I've got the code from Processing's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.