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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:04:46+00:00 2026-05-14T02:04:46+00:00

I am trying to some pretty basic RMI: // Context namingContext = new InitialContext();

  • 0

I am trying to some pretty basic RMI:

//   Context namingContext = new InitialContext();
         Registry reg = LocateRegistry.createRegistry(9999);
         for ( int i = 0; i < objs.length; i++ ) {
            int id = objs[i].getID();
//            namingContext.bind( "rmi:CustomObj" + id , objs[i] );
            reg.bind( "CustomObj" + id , objs[i] );
         }

That works without a hitch, but for future purposes, I need to use InitialContext.

         Context namingContext = new InitialContext();
         for ( int i = 0; i < objs.length; i++ ) {
            int id = objs[i].getID();
             namingContext.bind( "rmi:CustomObj" + id , objs[i] );
         }

But I cannot get this to work. I have started rmiregistry from the command line. Is there an equivalent of LocateRegistry.createRegistry(int)? Or some other way to start the RMI registry / registry used by InitialContext from inside my class? (Instead of the command line)


Stack trace:

javax.naming.CommunicationException [Root exception is java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: 
        java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is: 
        java.lang.ClassNotFoundException: bguiz.scratch.network.eg.Student]
        at com.sun.jndi.rmi.registry.RegistryContext.bind(RegistryContext.java:126)
        at com.sun.jndi.toolkit.url.GenericURLContext.bind(GenericURLContext.java:208)
        at javax.naming.InitialContext.bind(InitialContext.java:400)
        at bguiz.scratch.RMITest.main(RMITest.java:29)
Caused by: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: 
        java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is: 
        java.lang.ClassNotFoundException: bguiz.scratch.CustomObj
        at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:396)
        at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:250)
        ....(truncated)

EDIT: I will delete my own question in a couple of days, as there seems to be no answer to this (I haven’t been able to figure it out myself). Last call for any biters!

  • 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-14T02:04:47+00:00Added an answer on May 14, 2026 at 2:04 am

    After much tinkering, I’ve solved the problem. FYI, here’s what it was:

    The ClassNotFoundException is getting thrown because of RMI registry has its own classpath. It doesn’t matter that the class containing the InitialContext has the custom objects on its classpath – The RMI registry must be initialised such that the custom objects are on its classpath as well.

    To do this set the classpath environment value on the comman line prior to starting rmiregistry. If this classpath contains the custom object’s class, the ClassNotFoundException is not thrown, and subsequently ServerException and `CommunicationException’ are avoided.

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

Sidebar

Related Questions

Need some help with what is probably a pretty basic SQL query. I'm trying
It seems like I need some pretty basic JS help. I an trying to
I'm pretty new to Nhibernate and QueryOver techniques. Peace if I'm asking some basic
I'm starting to learn socket.io and node.js I'm trying to do some pretty basic
I'm pretty new to c#, and i'm trying to understand something pretty basic. I
I'm trying to do some pretty basic form posts with Django, but whenever I
this is just some pretty standard code I have tried. What I am trying
I'm trying some iOS test applications on the new Mac mini, that supports Bluetooth
I am trying some basic application on Sencha Touch 2. Instead of json ,
I am trying to configure some basic HTTP authentication over HTTPS using the spring

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.