假设我有这些行:
Registry registry = LocateRegistry.getRegistry(2121);
RemoteObject probe = (RemoteObject)registry.lookup(REMOTE_OBJ_NAME);//this throws exception
probe.doSomething();
例外是:
java.lang.ClassCastException: $Proxy1 cannot be cast to app.RemoteObject
为了清楚起见,RemoteObject
实现了一个扩展接口java.rmi.Remote
。