java的 rmi遠程調用給分布式編程帶來極大的方便,在使用rmi過程中若遇到以下兩個問題,可以嘗試如下的解決方法
問題1:java.rmi.server.ExportException: remote object implements illegal remote interface; nested exception is: java.lang.IllegalArgumentException: illegal remote method encountered:
解決方法 :若提示這樣的錯誤說明接口函數未設置異常拋出,在所提示的函數后面加上throws RemoteException即可解決
問題2:exception: java.rmi.UnmarshalException: error unmarshalling return; nested exception is: java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException :
解決方法:若提示這樣的錯誤說明某個類是不能序列化的,需要在該類加上implements Serializable,即可解決