aspose file tools*
The moose likes Distributed Java and the fly likes dynamic code downloading problem with RMI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "dynamic code downloading problem with RMI " Watch "dynamic code downloading problem with RMI " New topic
Author

dynamic code downloading problem with RMI

keisin syu
Greenhorn

Joined: Dec 04, 2002
Posts: 25
My directory structure:
server:
C:\rmisample\server\
..\public\classes\engine\ComputeEngine_Stub.class
..\ComputeEngine_Skel.class
..\src\compute.jar
..\engine\ComputeEngine.class
client:
C:\rmisample\client\
..\public\classes\client\Pi.class
..\src\compute.jar
..\client\ComputePi.class
..\Pi.class
firstly, I start rmiregistry:
1) set classpath=
--I want to unset classpath, is right?
2) start rmiregistry
2. start server of engine.ComputeEngine int directory C:\rmisample\server\src>
java -classpath compute.jar;.
-Djava.rmi.server.codebase=file:/c:\rmisample\server\public\classes/
-Djava.rmi.server.hostname=localhost
-Djava.security.policy=java.policy
engine.ComputeEngine
3. run client program client.ComputePi in directory C:\rmisample\client\src>
java -classpath compute.jar;.
-Djava.rmi.server.codebase=file:/c:\rmisample\client\public\classes/
-Djava.security.policy=java.policy
client.ComputePi 10.194.72.80 20
it will work if they are run on the same PC.
but if I move the client part to the other one,
i cannot run the client and get the exception like this:
ComputePi exception: error unmarshalling return; nested exception is:
java.lang.ClassNotFoundException: engine.ComputeEngine_Stub
java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
java.lang.ClassNotFoundException: engine.ComputeEngine_Stub
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at java.rmi.Naming.lookup(Naming.java:84)
at client.ComputePi.main(ComputePi.java:14)
if I copy the stub of server to the classpath of client,
it will work with two PCs.
this exception looks like from the setting of classpath of rmiregistry
but WHY? is it right i execute "set classpath=" to unset classpath?
(I'm using WindowsXP)
and I have another question about this topic, because the server need class Pi for ComputeEngine, and will upload Pi.class to the sever side.
is done by rmiregistry? why can it be done by the rmiregistry, but the stub is not?
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Moving this the Distributed Java.


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: dynamic code downloading problem with RMI