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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
| import java.rmi.Remote; import java.rmi.RemoteException;
public interface IRemote extends Remote { public void test() throws RemoteException; }
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:
1 2 3
| 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
1 2
| -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 ?!