Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

dynamic code downloading problem with RMI

 
keisin syu
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving this the Distributed Java.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic