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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:01:24+00:00 2026-05-17T22:01:24+00:00

I have an RMI Server which correctly binds to an RMI Registry when running

  • 0

I have an RMI Server which correctly binds to an RMI Registry when running on localhost (to demonstrate that things are setup correctly). The code which does this is:

 private void exposeTickHistoryRemoteProvider(TickHistoryRemoteInterface aTickHistoryServer) {
        if (System.getSecurityManager() == null) {
            SecurityManager mySecurityManager = getSecurityManager();
   System.setSecurityManager(mySecurityManager);
        }
  String rmiServerHostname = System.getProperties().getProperty("java.rmi.server.hostname");
  try {
   TickHistoryRemoteInterface stub =
                (TickHistoryRemoteInterface) UnicastRemoteObject.exportObject(aTickHistoryServer, 0);
            Registry registry = LocateRegistry.getRegistry(rmiServerHostname);
            String[] services = registry.list();
            registry.rebind(RMI_SERVICENAME_REUTERS_TICKHISTORY_SERVER, stub);
            log.info(RMI_SERVICENAME_REUTERS_TICKHISTORY_SERVER + " bound");
        } catch (Exception e) {
         log.error(RMI_SERVICENAME_REUTERS_TICKHISTORY_SERVER + " exception:" + e.toString());
            e.printStackTrace();
        }
    }

My localhost is running Windows with the following version of Java:

C:\eclipse>java -version
java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode)

Now, my issue is that I want to bind to an RMIRegistry running on a different machine (running Ubuntu 10.04, with OpenJDK IcedTea6 1.8.1, java version 1.6.0_18).

On this Ubuntu machine, I have nothing in my CLASSPATH (echo $CLASSPATH), and am running the OpenJDK RMIRegistry (as opposed to the one bundled with Ubuntu):

sudo /usr/lib/jvm/java-6-openjdk/jre/bin/rmiregistry &

Now, in the code above, when variable rmiServerHostname is “localhost” with the RMIRegistry running on my Windows localhost, the code works correctly (the RMI Server code binds to the RMI Registry). However, when rmiServerHostname is my remote Ubuntu machine (“deity”) I get the following exception thrown on the “rebind” invocation:

 java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: 
 java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is: 
 java.lang.ClassNotFoundException: com.relative.tickhistory.provider.TickHistoryRemoteInterface
 java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: 
 java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is: 
 java.lang.ClassNotFoundException: com.relative.tickhistory.provider.TickHistoryRemoteInterface

If I kill the RMIRegistry, I get a different error message (I would expect):

 java.rmi.ConnectException: Connection refused to host: deity; nested exception is: 
 java.net.ConnectException: Connection refused: connect
 at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)
 at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source)
 at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source)
 at sun.rmi.server.UnicastRef.newCall(Unknown Source)
 at sun.rmi.registry.RegistryImpl_Stub.list(Unknown Source)

I would assume there is no incompatibility between these implementations of RMIRegistry (Windows Java6 and Ubuntu OpenJDK 6)… but, I am unsure how to get to the bottom of this one. Especially because I know the code works correctly (in the first, Windows/localhost) example.


Progress So Far

Thanks alot for the helpful responses. I understand that I was getting confused between the rmiServerHostname (running on my localhost), and the rmiRegistryHostname (running on ‘deity’). I have revised the code, with the following, but am still getting the same problem (note the change in the line “Registry registry = LocateRegistry.getRegistry(rmiRegistryHostname)”):

    String rmiServerCodebase = System.getProperties().getProperty("java.rmi.server.codebase");
    String rmiServerHostname = System.getProperties().getProperty("java.rmi.server.hostname");
    String rmiRegistryHostname = "deity";
    System.out.println("rmiServerCodebase=" + rmiServerCodebase + "; rmiServerHostname=" + rmiServerHostname);
    try {
        TickHistoryRemoteInterface stub =
            (TickHistoryRemoteInterface) UnicastRemoteObject.exportObject(aTickHistoryServer, 0);
        Registry registry = LocateRegistry.getRegistry(rmiRegistryHostname);

The output of the print statement is (note, my localhost is ‘RTPC-16’)

"rmiServerCodebase=file:///C:/workspace/DEV/ReutersTickHistoryServer/ReutersTickHistoryInterface.jar; rmiServerHostname=RTPC-16"

This file does exist:

C:\>dir c:\workspace\DEV\ReutersTickHistoryServer\ReutersTickHistoryInterface.jar
 Volume in drive C is OS
 Volume Serial Number is 7AEB-A105

 Directory of c:\workspace\DEV\ReutersTickHistoryServer

22/10/2010  12:21 PM             9,467 ReutersTickHistoryInterface.jar
               1 File(s)          9,467 bytes

So, to summarise once more:

  • This code works when RMIRegistry and RMIServer are on same physical host (eg, localhost)
  • The problem occurs when I try to run only the RMIRegistry process on a separate host (ie, RMIRegistry is running on ‘deity’ as I want it to be whilst RMIServer is running on my localhost ‘RTPC-16’)
  • I was bundling the RMI interface codebase (“ReutersTickHistoryInterface.jar”) on both the client and server, so I was not anticipating RMI would need to transport any class definitions – RMI simply create the stub classes on the client and handle the actual RMI calls
  • 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-17T22:01:24+00:00Added an answer on May 17, 2026 at 10:01 pm

    You are getting this exception because the rmiregistry can’t locate the remote object’s stubs or other classes needed by the stub. You need to specify the java.rmi.server.codebase property when starting the server, set to be the location of the implementation stubs. This is required so that the stub class can be dynamically downloaded to the registry.

    For more details on this property take a look at the Dynamic code downloading using RMI tutorial.

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

Sidebar

Related Questions

We have a setup in which EJB A is running on server A, and
I have a very simple Java RMI Server that looks like the following: import
I am adapting a little rmi client-server application. I have written several things :
I have some code which I am making available via RMI. If my program
I have to implement an RMI server which will be a front end for
I have two applications communicating via RMI, a slave server (of which there will
I have a simple RMI 'compute' server application (similar to this ) that accepts
I have an RMI program which runs fine on my computer, but when I
I have an application which exposes a service via Spring's RMI proxy mechanism. There
It's the first time I use java Rmi*. I have a custom class which

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.