【发布时间】:2018-08-15 01:12:14
【问题描述】:
我得到了错误
java.lang.ClassCastException: com.sun.proxy.$Proxy0 cannot be cast to ServerInterface
when(导致问题的第二行)
Registry myreg = LocateRegistry.getRegistry(hostname, portnumber);
interOne = (ServerInterface) myreg.lookup(ServerOne);
interOne 已经被声明为
private static ServerInterface interOne;
它只是服务器接口的三个实例之一;一共有三个。服务器界面如下:
import java.io.File;
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface ServerInterface extends Remote {
void uploadFileToServer(byte[] mybyte, String serverpath, int length) throws RemoteException;
byte[] downloadFileFromServer(String servername) throws RemoteException;
String[] listFiles() throws RemoteException;
boolean removeDirectoryOrFile(String serverpath) throws RemoteException;
int directorySize(File directory);
}
【问题讨论】:
标签: java ftp network-programming client-server rmi