I am creating a java program which implements an interface to export functions over RMI. All my classes have been defined to be in the package jblog
, including the interface class.
Unfortunately I am getting an exception (which I am catching) when running the program.
I am using the following commands:
#java -classpath . jblog/BlogServer
*** Server exception: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
The exception seems to suggest that the BlogServerInterface class cannot be found, however this class file is in the same directory as the BlogServer class.
Here is the code for BlogServer and I have pointed out where the exception is being thrown:
//create an object of current class and get stub
BlogServer obj = new BlogServer();
BlogServerInterface stub = (BlogServerInterface) UnicastRemoteObject.exportObject(obj, 0);
// Bind the remote object's stub in the registry
Registry registry = LocateRegistry.getRegistry();
registry.rebind("BlogServerInterface", stub); // EXCEPTION THROWN HERE
//server ready, now waiting for calls
printToConsole("Server ready for remote calls");
} catch (Exception e)
printToConsole("Server exception: " + e.toString());
Any help much appreciated, thanks.