當我跑我的RMI應用它的工作,但是當我嘗試不同的PC與我收到此錯誤不同的地址在我的代碼:註冊表RMI找不到stub類
java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
java.lang.ClassNotFoundException: zz.INTERFCE at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source) at java.rmi.Naming.lookup(Unknown Source) at CLIENT$2.actionPerformed(CLIENT.java:112) . . .
好的。這是我的代碼:我的應用程序寬:服務器
try {
System.setProperty("java.security.policy","C:\\DERNIER\\src\\security.policy");
System.setSecurityManager(new RMISecurityManager());
registre = LocateRegistry.createRegistry(Integer.parseInt(textport.getText()));
IMPLIEMENT obj=new IMPLIEMENT();
registre.rebind("Hello1",obj);
list1.add("serveur is lisning");
cpt++;
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
客戶端
try {
user=txtUN.getText();
client=new CLIENT_IMPLMENT(rsa,user);
hello= (INTERFCE) Naming.lookup("rmi://"+textadressz.getText()+":"+Integer.parseInt(txtport.getText())+"/Hello1");
hello.connecté((CLIENT_INTERFCE)client,user,rsa.getN(),rsa.getE());
cpt++;
} catch (RemoteException | MalformedURLException | NotBoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
PS的 側ork在localhoste的罰款
分享您的代碼PLZ。 –