Solved

RMI Unmarshall Exception

Posted on 2010-11-29
4
647 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
ID: 34236315
Does your registry server know about the interface class?
0
 
LVL 92

Assisted Solution

by:objects
objects earned 125 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Java Message handling in Service Layer 3 58
eclipse java  build path 6 45
jar file executable 12 43
eclipse shortcuts 9 45
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…
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 learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

867 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

22 Experts available now in Live!

Get 1:1 Help Now