I am having strange problem and spent a lot of time to figure it out with no success. I have created a jar file and trying to test that from diferent drive on my machine, say c:\test folder. For testing I am using folling to command: c:\test\start rmiregistry c:\test\java -Djava.security.policy=server.policy -jar server.jar -d db.db When the server try to bind to registry it gives error saying: Error: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is: java.lang.ClassNotFoundException: suncertify.server.DatabaseImplServer_Stub It look like it is trying to find the stub file of the server implementation and did not get it, it is there though. I gave the jar file to one on my friend to run this two command on his machine and it worked. Also on my machine, if I run the first command to start the rmiregistry from the application folder, where I created the application, and then run the second command from any place to run the jar file then works!!! Any idea or suggestion will be greatly appreciated.
I believe that the problem is that when you start the rmiregistry command it can't have access in the classpath to the stub class. That is why if you launch the rmiregistry in a different folder than the stub it works. To solve the problem you have to either start the rmiregistry in a different directory OR set the classpath to nothing or a directory that doesn't contain the stub. On windows you can use the following set of commands: <code> C:\SET TEMP=%CLASSPATH% C:\start rmiregistry C:\SET CLASSPATH=%TEMP% C:\java ... (Application Executable) </code> The section called Start the Server on the RMI Tutorial provides more information on this issue. Hope this helps.
posted 18 years ago
The link helped. Thanks a lot.
Good heavens! What have you done! Here, try to fix it with this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!