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 7849241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T18:27:25+00:00 2026-06-02T18:27:25+00:00

First off, I’d love to post some real code for this question, but I

  • 0

First off, I’d love to post some real code for this question, but I can’t because it’s far too many lines. That said, here’s my situation:

Server Side

I have an RMI Server that waits for Clients to connect and “register” themselves, so that the Server can make function calls on Clients. Basically, the server has a published function that works like the following pseudo-code:

public class Server extends UnicastRemoteObject implements ServerInterface{
    public Server(){ /* Server publishes itself here */ }

    ...

    /** One of many methods visible to a remote Client */
    public void registerClient(Client c) throws RemoteException{
        //1. Make some remote calls on 'c' for book-keeping purposes
        //2. Store reference to c to make calls on it later
    }
}

Client Side

On Startup, the Client makes a call to Naming.lookup([url]) to get a stub to the Server that I’ll call serverRef, then calls serverRef.registerClient(this). The problem happens the first line of the server’s registerClient(Client c) method.

Problem

When the server makes its first remote method call to the Client inside the registerClient method, a RemoteException is thrown. While client and server machines are on the same subnet, the client’s machine has a secondary IP address. So the IPs look something like this:

Server Machine IPs: 123.45.67.1
Client Machine IPs: 123.45.67.2, 192.168.67.2

The RemoteException that gets thrown during the Server’s first remote call back to the client indicates that the Server is trying to connect to the Client’s 192.168.67.2 address, which is what’s causing the failure. The Server should be trying to connect to the 123.45.67.1 address. I know that disabling the network interface that belongs to the second IP address would fix the problem, but this isn’t really an option for me.

Is there any way to “tell” server-side RMI which IP address to connect on when opening a connection to a new client-side object stub?

  • 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-02T18:27:26+00:00Added an answer on June 2, 2026 at 6:27 pm

    There are several possible solutions, including

    • write a custom client socket factory

    • specify addresses in java.rmi.server.hostname property

      -Djava.rmi.server.hostname=ip_address

    • etc

    Check out this link:

    • http://weblogs.java.net/blog/emcmanus/archive/2006/12/multihomed_comp.html

    These links are also useful:

    • java rmi -Djava.rmi.server.hostname=localhost still opens a socket listening on 0.0.0.0

    • http://www.chipkillmar.net/2011/06/22/multihomed-hosts-and-java-rmi/4/java-rmi-djava-rmi-server-hostname-localhost-still-opens-a-socket-listening-on

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

Sidebar

Related Questions

First off, this question is ripped out from this question. I did it because
First off, apologies if this question has been asked before but I couldn't find
First off I'm horrible with regex, hoping I can get some help here cause
first off this is a class assignment so i would appreciate help but just
First off I apologize if there is another post out there that answers this,
First off, please accept my apologies if this question is basic, I mainly have
First off, apologies if this is a duplicate of an existing question. Wasn't precisely
First off, I am cross-posting this from Server Fault because I did not receive
First off: Everything works , but I would like to fine tune this a
First off, apologies if this is a complete noob question which could easily be

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.