Link to home
Start Free TrialLog in
Avatar of SnowCrash89
SnowCrash89

asked on

RMI Unmarshall Exception

Hi,

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:

#rmiregistry &
#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: 
        java.lang.ClassNotFoundException: jblog.BlogServerInterface

Open in new window


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:

		try
		{
			//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());
		}

Open in new window


Any help much appreciated, thanks.
ASKER CERTIFIED SOLUTION
Avatar of sweetfa2
sweetfa2
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of SnowCrash89
SnowCrash89

ASKER

Yes thanks looks like I need to edit the codebase so that the interface class is found. I went for the easier option for now and removed all my classes from the jblog package (so now package is specified). This way it seems to have no trouble finding the class as the program works fine.
correction: *so no package is specified