ClassCastException in RMI application
Hello,
i found some mails complaining about ClassCast Exception but mine is a
bit different and i coulnt find any explanation.. Please help me..
********** CList Interface *************
import java.rmi.*;
import java.util.Properties;
public interface CList extends Remote{
public Properties getClients() throws RemoteException;
}
********** CListImpl ******************
import java.rmi.*;
import java.rmi.server.*;
import java.util.Properties;
public class CListImpl extends UnicastRemoteObject
implements CList {
public CListImpl () throws RemoteException {
}
public Properties getClients() throws RemoteException{
return clients;
}
public Properties clients=new Properties(); // I'm trying to return
back a Properties file..
}
*********** CListClient ****************
import java.rmi.*;
import java.rmi.server.*;
import javax.naming.*;
import java.util.Properties;
public class CListClient {
public static void main(String[] args)
{
System.setProperty("java.security.policy", "client.policy");
System.setSecurityManager(new RMISecurityManager());
String url = "rmi://localhost/";
try
{
Context namingContext = new InitialContext();
CList c1 = (CList) namingContext.lookup(url +
"akclients"); // Register name
Properties clients=new Properties();
clients=(Properties)c1.getClients();
System.out.println(clients);
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
************** In the Server side *******************
import java.util.Properties;
import java.rmi.*;
import java.rmi.server.*;
import javax.naming.*;
public class Server {
public CListImpl c1;
public Server(){
}
}