Thanks Ben. I will try out the methods suggested by you. Meanwhile I am having a hard time testing dynamic stub downloading in RMI. Here is the long mail on the problems I am facing and my efforts to solve it..
Have you or anyone else tested Dynamic stub download in RMI using File URL as Codebase ? I am trying to do that and not able to make it work and can not figure out why it won't work. I tried all the methods mentioned in different tutorials and books but to no avail.
I have following directory structure (all on same PC):
c:\rmi - no .class files in this directory
c:\rmi\server - all server related .class files (including _stub)
c:\rmi\client - all client related .class files
my CLASSPATH is - .;.. (current and parent directory only)
Now I do the following to execute the RMI application:
1. start rmiregistry with 'start rmiregistry' command from c:\rmi directory (note that no .class files are in this directory and hence rmiregistry should not find _stub class file in its CLASSPATH).
2. start RMI server from c:\rmi\server directory with codebase set to c:\rmi\server.
This step works fine. I know that because, if I do not specify the correct directory on the File URL, I get a 'Unmarshalling error' during Naming.rebind() call. This means that rmiregistry is indeed anotating _stub properly with server's codebase, right ? Is there a way to verify (by a System.out.println() may be) _stub's codebase as annotated by rmiregistry, after Naming.rebind() call ?
But I do have a question here. I am on Win95 and any of the following 3 forms of file URLs seem to work fine: file:///c:/rmi/server/
which one is correct as per you ?
3. start RMI client from c:\rmi\client directory.
This is where I get 'Unmarshalling error'. (Client does work fine if I copy _stub to c:\rmi\client directory. Of course then I have not used dynamic downloading of _stub).
As per all tutorials I read, dynamic downloading should happen if:
-rmiregistry does not find download classes in its classpath
-server has correct codebase
-client does not find _stub in it's local classpath
I think I am satisfying all the three criteria. What am I missing ?
I also have other questions:
1. If I have a HTTP server running and I use an HTTP URL for
codebase, _stub is downloaded to client using HTTP protocol, right? How does the download take place when I use a File URL? FTP ? If FTP, who provides the FTP service ?
2. Do I need to set codebase for RMI client also, to make it work ?
3. I had to set java.policy on client also (besides server) to come to 'unamrshalling error' on client side. Is that always necessary ?
4. My PC has Computer name = 'D071479' on Control
Pannel/Network/Identification panel. I tried setting
java.rmi.server.hostname=D071479 also. But it did not work either
5. Do you think I should go for HTTP URL instead of File URL for server codebase ? Which method did you use for RMI testing ?
All your time and help are greatly appreciated.