Hi all, im trying to run so many codes using java RMI and nothing seems to work. im on the point of banging my head on the PC.
Im sure evryone is aware of the popular Calculator example: Calcuator.java, CalcuatorImpl.java, CalcuatorClient.java and CalcuatorServer.java. I hae done this and other examples at University and they executed and compiled all fine but when I run them on my own PC, I get the following error. could some one help me please.

java.rmi.ServerException: RemoteException occurred in server thread;
nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments;
nested exception is:
java.lang.classNotFoundException: Calculator

So? Do you have the proper client library? Classes don't appear out of thin air.

HI,
I have the same problem. getting this error:

xception in FibonacciImpl.main: 
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: 
	java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is: 
	java.lang.ClassNotFoundException: com.ora.rmibook.gui.FibonacciImpl_Stub

*I am using Jbuilder 2005 to create this app.
*the stubs and the skel classes have been
created and i believe they are in right folder.
*started rmiregistry but after compiling the
main class i get this above error!.

I went through all the sources online but they keep saying that you need to add your stub in your rmi registry classpath!! .. how do i add tat ?
all i know i can start rmiregistry from command prompt. but i dont know how to tell rmi where to locate the stubs. although they are in the same folder.
I also copied all my project files to a temp folder in D drive but same error. i did tat cuz i read somewhere that tomcat server gives error when there are spaces in the folder files. but tat didnt work either. HELP. thanks
please help and advice..need to learn this badly.
if u have any questions , lemme know.
thanks.

Reading this should definitely help you out, if not then post your code.

Your Remote object must Extend UnicasRemoteObject Class directly or indirectly.
UnicastRemoteObject does the marshalling and unmarshalling i.e converting arguements and return values to bytes that can be sent over the network.

taking the example of the calculator program:

Calculator would be the interface which extends Remote then your remote objects would be defined by the class CalculatorImpl.

CalculatorImpl should extend UnicastRemoteObject directly i.e

public class CalculatorImpl extends UnicastRemoteObject

or indirectly by extending a class which already inherits from UnicastRemoteObject

that will deal with the UnmarshalException

For the ClassNotFoundException Make sure you have all the classes and stubs in the right directories

import java.rmi.*;
import java.rmi.server.*;
import java.net.*;

public class server 
{
public static void main(String args[])throws Exception
{
if (System.getSecurityManager() == null)
            System.setSecurityManager ( new RMISecurityManager() );
try
{
sampleserverimpl server = new sampleserverimpl();
Naming.rebind(

check the port number in the Naming. rebind.....

default port for rmi is 1099 if you want to use different port you have to do

start rmiregistry <portnumber>

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.