Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

RMI Unmarshall Exception

Posted on 2010-11-29
4
Medium Priority
?
677 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 17

Accepted Solution

by:
sweetfa2 earned 500 total points
ID: 34236315
Does your registry server know about the interface class?
0
 
LVL 92

Assisted Solution

by:objects
objects earned 500 total points
ID: 34236320
you need to make the classes network accessible

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

Author Comment

by:SnowCrash89
ID: 34236369
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
ID: 34236373
correction: *so no package is specified
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses

715 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