大家好日子! 我有問題,以我的RMI爲例。 一週前,我嘗試開始我的第一個RMI示例,它的工作,但我刪除項目,並嘗試再次創建,但我不能,因爲'拋出ExportException。 我做錯了什麼?也許我需要重新啓動rmiregistry.exe或其他東西?RMI示例和ExportException
public interface IExample extends Remote {
public String getMessage(String input) throws RemoteException;
}
public class ExampleImpl extends UnicastRemoteObject implements IExample {
public ExampleImpl() throws RemoteException {
super();
}
@Override
public String getMessage(String input) throws RemoteException {
return "Hi " + input + "!!!";
}
public static void main(String... args) throws RemoteException, MalformedURLException {
System.setSecurityManager(new RMISecurityManager());
String name = "myexample";
IExample engine = new ExampleImpl();
IExample stub =
(IExample) UnicastRemoteObject.exportObject(engine, 1090);
Registry registry = LocateRegistry.getRegistry();
registry.rebind(name, stub);
}
}
P.s.所有的Thx,併爲我的英語感到抱歉。 P.p.s.和我愚蠢的問題。
您應該始終發佈異常和堆棧跟蹤。 – EJP