So, the problem is I have some server code that will allow a Client to call functions on it using rmiregistry. It should be noted I'm running these commands on OS X terminal and I have two folders I'm working within:
RMI
- which will call the rmiregistry and
Server
- which has all my server code in it
So, I open one terminal and enter this:
rmiregistry -J-Djava.rmi.server.codebase=file:/Desktop/RMI/Server/ &
All is well, I get a port back.
I then login to the Server folder that contains my server code to run my calculatorserver
program.
Now I've been told to specify the codebase and the security policy:
java -Djava.rmi.server.codebase=file:/Desktop/RMI/Server/ -Djava.security.policy=server.policy calculatorserver
However, I keep on getting this same error:
Server Error: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: calculator
I know the only reason I'm getting this error is because the rmiregistry can't find the server object.
Some guidance would be appreciated
That's not a real HTTP URL. It's a directory name with http:
stuck in front of it. You need to use a real http:
URL with a real HTTP server. Or FTP.
You can use a file:
URL, but then you're more or less stuck within a single host, in which case you don't actually need the codebase feature at all. And if you do use a file:
URL, it has to be intelligible to the Registry and the client, which again means either they're all in the same host or it names a shared directory that the Registry and client can see.
NB Don't specify the codebase to the Registry (or the client, unless it exports remote (callback) objects): only to the server JVM