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

  • Home
  • SEARCH
  • 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 3406316
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T05:36:47+00:00 2026-05-18T05:36:47+00:00

We are using a client/server RMI communication in the same computer (so all ip

  • 0

We are using a client/server RMI communication in the same computer (so all ip should be localhost).

We start the registry (using the default port 1099)


registry = LocateRegistry.createRegistry(port);

and export some objects to the RMI registry


Naming.rebind("//" + "localhost" + ":" + port + "/" + name, object);

From another process we retrieve some objects (remember everything runs in localhost)


MyRemoteObject ro = (MyRemoteObject) Naming.lookup("//" + "localhost" + ":" + port + "/" + name);

The issue happen when you run the app starting with local area network working and in the middle of the process you disable the network connection.
If you run the app and the LAN is working no issue popup, and if you run the app and the LAN is not working no issue popup. It just happens when you change the LAN while you are running the app.

The exception thrown while executing Naming.lookup() method is this one:


java.lang.RuntimeException: java.rmi.ConnectIOException: Exception creating connection to: 192.168.x.x; nested exception is:
java.net.NoRouteToHostException: No route to host: connect

Debugging a little bit I found out that the

RemoteObject ($Proxy0) -> RemoteObjectInvocationHandler -> UnicastRef2 -> LiveRef -> TCPEndpoint

had the ip of the host (e.g.: 192.168.x.x) instead of “localhost” or 127.0.0.1 (what it would be what I wanted).
And the isLocal boolean of liveRef object is always false.

I don’t know if it is clear enough. Sorry!!!

Do you have any suggestions?

My Tries:

I tried this solutions

  1. Run the jvm with -Djava.rmi.server.hostname=localhost argument
  2. Redefine RMIServerSocketFactory to return 127.0.0.1 everytime. (TCPEndpoint has 192.168.x.x ip and isLocal is always false)
  3. Call rebind and lookup with no host in the URI. This is supposed to mean localhost.

but none of these have worked.

Any suggestion will be welcome.

  • 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-05-18T05:36:47+00:00Added an answer on May 18, 2026 at 5:36 am

    java.rmi.server.hostname should do the trick. You did set it on server, right?

    If java.rmi.server.hostname=localhost does not work, how about java.rmi.server.hostname=127.0.0.1 or java.rmi.server.hostname=::1?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In our application, we are using RMI for client-server communication in very different ways:
I start to write a client - server application using .net (C#) for both
I have a client-server application written in Java using CORBA for the communication. The
I wrote a server-client rmi application and I'm using MacOsX and Ubuntu laptops to
I'm using VisualSVN client and server and one of the requirements for web projects
I`m writing client-server app for windows using WinSock and I have class for server.
I'm writing a client-server app using BSD sockets. It needs to run in the
Or would a conventional client-server VCS be more appropriate? I'm currently using TortoiseSVN, but
I am looking at building a client server application in C# using winforms or
I have no experience with web services. Historically I've built client-server systems using proprietary

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.