Date: Mon, 20 Jul 1998 23:59:12 -0500
From: Rohan Madhuker Agni <rma4371@cs.tamu.edu>
Subject: Observations on codebase and downloading of stubs
To: RMI-USERS@JAVA.SUN.COM
Hello,
I have been going nuts with this codebase stuff for some time now. I have
learnt a lot in the process though. The following is what I have gathered
from the archives and from reponses to my previous email on codebase.
If any of the observations are wrong, I'd appreciate if someone cared to
correct them.
1. The property java.rmi.server.codebase specified for an RMI server(an
exporter of RMI objects) tells the RMI registry where the stubs for the
remote objects are located. This information is conveyed to the registry
during the binding process. Note that it doesn't matter that the stubs are
available in the RMI server's classpath. The rmiregistry still uses
the codebase property (which may point to a web directory) to annotate the
stubs.
2. The registry's classpath should not contain the stubs (in the general
scenario). If it does, then the codebase property will not be used by the
registry to annotate the stubs as it would load the stubs from its
classpath.
3. The codebase property is set to a URL that points to the stubs and
specifies how to download them (http or ftp). These stubs could be hosted
by any webserver/ftp server, not necessarily the one running on the RMI
server's machine. Is this correct?
4. If the stubs belong to a package Test, then do the following:
a. Create a directory Test in the web directory allocated for your use and
copy the stubs there.
b. Set the codebase property as
-Djava.rmi.server.codebase=http://www.xxx.yyy/Mydirectory/ while starting
the RMI server.
Note that the directory Test is located in Mydirectory
Be sure that Test and the stubs are world readable.
5. If the client code IS AVAILABLE on the client machine which is
different from the RMI server machine, NO BOOTSTRAPPING MECHANISM IS
NEEDED. The RMIClassLoader will AUTOMATICALLY download the stubs for the
classes when a lookup is done for an object whose stub is not available in
the local classpath.
-----------------------------------------------------------------------
Assuming that all these observations are correct, I still can't figure out
where I go wrong.
Here's what I do.
1. Put ALL the .class files in the web directory, Test (everything is
world readable). Note that Test is created in my web area (MyDirectory).
2. All these files are available in a directory Test that exists in my
home directory too (not my web home).
3. Start rmiregistry. Its classpath is null.
4. Start rmid. (Since I need to use Activatable objects)
5. Run the Setup program. This registers the Activatable implementation
with rmid and binds it to the registry. Hence the Setup program serves as
the RMI server. It is run with the following command from my home
directory.
java -Djava.rmi.server.codebase=http://www.xxx.yyy/MyDirectory/
Test.MySetup
All the classes including stub classes are available in the Setup
program's classpath.
6. The client program is on a different machine but has the client .class
file. It throws an exception when a lookup is done for the remote object.
The exception is ClassNotFound: Test.MyClassImpl_Stub
However, I get the same exception when I don't specify the codebase
property while running my Setup program. This seems to imply that the
stubs are not annotated with the codbase URL at all in my case. WHY?
Thanks for reading. I'd really appreciate some help.
Rohan.
===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff RMI-USERS". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".
For a list of frequently asked RMI questions please refer to:
http://java.sun.com/products/jdk/rmi/faq.html
To view past RMI-USERS postings, please see:
http://java.sun.com/products/jdk/rmi/archives/index.html