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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:24:05+00:00 2026-06-04T17:24:05+00:00

Suppose I have a remote class that has a method with a POJO parameter:

  • 0

Suppose I have a remote class that has a method with a POJO parameter:

class MyRemote implements Remote {

    void service(Param param) throws RemoteException;

}

The client retrieves a stub and does:

// DerivedParam is defined by the client
// and is derived from Param
DerivedParam dparam = getDerivedParam();
myService.service(dparam);

It fails, because the server has no clue about the DerivedParam class (and interfaces that it possibly implements).

The question: is it somehow possible to pass those classes from client to server to make such an invocation possible?

  • 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-04T17:24:07+00:00Added an answer on June 4, 2026 at 5:24 pm

    I am no an expert on the subject, but I did pulled this trick some time ago. The magic is in the use of code mobility by means of setting the java.rmi.server.codebase property.

    You make this property point to a URL or space-separated list of URLs where your shared classes may reside. This could be, for instance, an FTP server or an HTTP server where a jar file with common classes reside.

    Once set up, the codebase annotation will be included in all objects marshalled by server and client, and when either party cannot find a class, they look it up in the URLs provided in the code base and would dynamically load it.

    Please read Dynamic Code Downloading with Java RMI.

    Let’s say you provide to your client only interfaces, and the implementations will be located in a given code base. Then the client requests the server to send a given object, the client expects to receive an object that implements a given interface, but the actual implementation is unknown to the client, when it deserializes the sent object is when it has to go to the code base and download the corresponding implementing class for the actual object being passed.

    This will make the client very thin, and you will very easily update your classes in the code base without having to resort to updating every single client.

    Let’s say you have a RMI server with the following interface

    public interface MiddleEarth {
         public List<Creature> getAllCreatures();
    }
    

    The client will only have the interfaces for MiddleEarth and Creature, but none of the implementations in the class path.

    Where the implementations of Creature are serializable objects of type Elf, Man, Dwarf and Hobbit. And these implementations are located in your code base, but not in your client’s class path.

    When you ask your RMI server to send you the list of all creatures in Middle Earth, it will send objects that implement Creature, that is, any of the classes listed above.

    When the client receives the serialized objects it has to look for the class files in order to deserialized them, but these are not located in the local class path. Every object in this stream comes tagged with the given code base that can be used to look for missing classes. Therefore, the client resort to the code base to look for these classes. There it will find the actual creature classes being used.

    The code base works in both directions, so it means that if you send your server a Creature (i.e. an Ent) it will look for it in the code base as well.

    This means that when both, client and server need to publish new types of creatures all they have to do is to update the creaturesImpl.jar in the code base, and nothing in the server or client applications themselves.

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

Sidebar

Related Questions

Please suppose I have a function that accepts a pointer as a parameter. This
Suppose I have a custom collection class that provides some internal thread synchronization. For
Suppose I have $('#routingNumber').removeClass(validationClass('#routingNumber')); (Where validationClass() is a regex that returns a class that
Suppose you have two linked servers called Local and Remote respectively. Is there a
Suppose I have: public class foobar { public int lorem; public int ipsum; }
Suppose I have string Name and Image Photo as properties of a class in
Suppose you have a subsystem that does some kind of work. It could be
Suppose I have a method which changes the state of an object, and fires
i have a List<my_Custom_Class> and List<string> . My custom class has various items in
I have a @WebService class that injects an @EJB. The EJB is packaged in

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.