Solved

RMI Unmarshall Exception

Posted on 2010-11-29
4
644 Views
Last Modified: 2012-06-27
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.
0
Comment
Question by:SnowCrash89
  • 2
4 Comments
 
LVL 17

Accepted Solution

by:
sweetfa2 earned 125 total points
Comment Utility
Does your registry server know about the interface class?
0
 
LVL 92

Assisted Solution

by:objects
objects earned 125 total points
Comment Utility
you need to make the classes network accessible

http://download.oracle.com/javase/tutorial/rmi/running.html
0
 

Author Comment

by:SnowCrash89
Comment Utility
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.
0
 

Author Comment

by:SnowCrash89
Comment Utility
correction: *so no package is specified
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now