JDK6 And ClassNotFound Exception during RMI server start

Hello,

I have been write a simple Hello World RMI, but I'm unable to start the server always get this exeception:

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: rmi.Hello

java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:

java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:

java.lang.ClassNotFoundException: rmi.Hello

at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:396)

at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:250)

at sun.rmi.transport.Transport$1.run(Transport.java:159)

at java.security.AccessController.doPrivileged(Native Method)

at sun.rmi.transport.Transport.serviceCall(Transport.java:155)

at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)

at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)

at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)

at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)

at java.lang.Thread.run(Thread.java:619)

at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)

at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)

at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:359)

at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source)

at rmi.HelloMain.main(HelloMain.java:21)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)

The sources are these:

package rmi;

import java.rmi.Remote;

import java.rmi.RemoteException;

publicinterface Helloextends Remote{

publicvoid sayHello()throws RemoteException;

}

package rmi;

import java.rmi.RemoteException;

publicclass HelloServerimplements Hello{

public HelloServer(){

super();

}

publicvoid sayHello()throws RemoteException{

System.out.println("Ciau!");

}

}

package rmi;

import java.rmi.registry.LocateRegistry;

import java.rmi.registry.Registry;

import java.rmi.server.UnicastRemoteObject;

publicclass HelloMain{

publicstaticvoid main(String[] args){

try{

Hello obj =new HelloServer();

Hello stub = (Hello) UnicastRemoteObject.exportObject(obj, 0);

// Bind the remote object's stub in the registry

Registry registry = LocateRegistry.getRegistry();

registry.bind("Hello", stub);

System.err.println("Server ready");

}catch (Exception e){

System.err.println("Server exception: " + e.toString());

e.printStackTrace();

}

}

}

May be I'm wrong with start command, but I tried differents syntax without result.

Can you help me?

Thanks to all.

PS:Sorry for my spaghetti-english :D

[5177 byte] By [FreeMana] at [2007-11-26 22:02:34]
# 1
HELP! :'(
FreeMana at 2007-7-10 10:43:09 > top of Java-index,Core,Core APIs...
# 2
The Registry can't find rmi.Hello via either the codebase feature if you're using it or its CLASSPATH if you're not.
ejpa at 2007-7-10 10:43:09 > top of Java-index,Core,Core APIs...
# 3
Hi, I found a workaround, My code seems is unable to find the RMi regstriy if I start by hand from command prompt, but I i create a new one from code all works file.Do you think the problem is still related to the codebase?Alfredo
FreeMana at 2007-7-10 10:43:09 > top of Java-index,Core,Core APIs...
# 4
Definitely, if you're using it. The Registry when run from a command prompt has no CLASSPATH. The Registry run inside your JVM has the same classpath as the JVM.
ejpa at 2007-7-10 10:43:09 > top of Java-index,Core,Core APIs...
# 5
Hi ,I'm facing similar problem when i try to run simple rmi program in Mac. Can you please specify the work around.Thanks in Advance.-JanakiRam.
Jsnia at 2007-7-10 10:43:09 > top of Java-index,Core,Core APIs...