Solved

RMI Unmarshall Exception

Posted on 2010-11-29
4
666 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 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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
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…

729 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