rmi中总是报告接口类没有找到,为什么?急!!!
我在客户端调用rmi的时候,将程序放在默认包下没有问题,将程序放到其他包里,会报告接口的那个类没有找到,为什么呀?
接口:
public interface Remote extends Remote {
public String GetInfoByPwd(String strUserID) throws RemoteException;
}
客户端
public class Client {
public static String getInfoByPwd(String userId){
Remote obj6 = null;
String serverName = "127.0.0.1";
String url = "rmi://" + serverName + "/";
String ret = null;
try {
obj6 = (Remote) Naming.lookup(url + "GetInfoByPwd");
ret = obj6.GetInfoByPwd("aaa");
} catch (MalformedURLException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
} catch (RemoteException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
} catch (NotBoundException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}
return ret;
}
public static void main(String[] args) {
System.out.println("aaaaaaaaa");
String str = Client.getInfoByPwd("test01");
System.out.println(str);
}
}