aspose file tools*
The moose likes Distributed Java and the fly likes How class will be loaded in the server in RMI? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "How class will be loaded in the server in RMI?" Watch "How class will be loaded in the server in RMI?" New topic
Author

How class will be loaded in the server in RMI?

Joybrata Chakraborty
Greenhorn

Joined: Nov 27, 2006
Posts: 29
Hi

Please help me to understand the follwoing example.
http://java.sun.com/docs/books/tutorial/rmi/overview.html

How Pi class will be loaded in the server JVM?


Joy


Thanks in advance
Karthik Shiraly
Ranch Hand

Joined: Apr 04, 2009
Posts: 475
    
    3
Hi,

The location where Pi class is available is set using the -Djava.rmi.server.codebase=file:/c:/home/jones/public_html/classes/ command line arg on client side.
When the remote method is called, server finds that it doesn't know the class Pi whose instance is sent by this client. So the RMI infrastructure loads the classes from the codebase specified by the same client. If another client sends a class Pi2 with a different codebase, the server side will load Pi2 from the second codebase. Each client can specify its own codebase. The server also can specify its own codebase to serve classes required by clients.

This RMI code downloading tutorial explains the different scenarios well.

A great way to understand what's going on in the RMI infrastructure on server side, client side and in registry is
- start all of them with the command line arg -Djava.util.logging.config.file=rmilogging.properties
- Create this file "rmilogging.properties" in the same directory with the following contents:
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How class will be loaded in the server in RMI?
 
Similar Threads
Different ClassLoaders loading Singleton class
rmi interview questions
RMI concepts plz help
URGENT!!!
can we dynamically load a object to the server??