Im very sad. Although im not very trained in using rmi this example worked yesterday
with little modifications. its just a very basic rmi program:
/**
* Remote Interface
*/
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface IRemote extends Remote
{
public void test() throws RemoteException;
}
/**
* Server
*/
import java.rmi.Naming;
import java.rmi.RMISecurityManager;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
public class HelloServer extends UnicastRemoteObject implements IRemote
{
public HelloServer() throws RemoteException
{
super();
}
public void test() throws RemoteException
{
System.out.println("REMOTE CALL");
}
public static void main(String args[])
{
try
{
if (System.getSecurityManager() == null)
{
System.setSecurityManager(new RMISecurityManager());
}
HelloServer h = new HelloServer();
Naming.rebind("rmi://localhost/Hello", h);
System.out.println("[DerServer]registrierte Objekte nach dem Binden");
for (int i = 0; i < Naming.list("rmi://localhost/").length; i++)
{
System.out.println("[Server] "+ Naming.list("rmi://localhost/")[i]);
}
System.out.println("[Server] ready.");
} catch (Exception re)
{
System.out.println("Exception: " + re);
}
}
}
The problem is that i get this exception thrwon by the rebind() method:
Exception: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: IRemote
Im using Eclipse 3.1 and Java 1.5 (so no rmic). Moreover im using as vm Arguments for Eclipse
-Djava.security.policy=grant_all.policy
-classpath .
the rmiregistry is running and working, if i dont implement the remote interface i can call it
using Naming.<…>
Why the **** hell cant it find the IRemote interface ?!