Guys,
I have a little problem with this simple RMI program...
Here the 4 classes:
--------------------------------------------------------------
import java.rmi.*;
public interface remoteInterface extends Remote {
public void printLosung() throws RemoteException;
}
--------------------------------------------------------------
import java.rmi.*;
import java.rmi.server.*;
public class server {
public static void main(
String[] args) {
try {
remoteObject obj = new remoteObject();
Naming.rebind("Tageslosung", obj);
} catch (Exception e) {
e.printStackTrace();
}
}
}
--------------------------------------------------------------
import java.rmi.*;
import java.rmi.server.*;
public class remoteObject extends UnicastRemoteObject implements remoteInterface {
public remoteObject() throws RemoteException {}
public void printLosung() {
System.out.println("text");
}
}
--------------------------------------------------------------
public class client {
public static void main(String[] args) {
//System.setSecurityManager(new RMISecurityManager());
try {
remoteObject obj = (remoteObject) Naming.lookup("rmi://localhost/Tageslosung");
obj.printLosung();
} catch (Exception e) {
e.printStackTrace();
}
}
}
--------------------------------------------------------------
After compiling, rmic-ing the remote object and registering it, I start server and client, but client gives me the message "ClassCastException" in the client class (obviously because of that remote object). But well, I don't get it really, I mean why? How should I do it then?
Thanks a lot for your help
