rendered paste body IRemoteSearchApi myRemoteSearchApi = null; try { Object myReference = Naming.lookup("rmi://localhost/SearchApi"); System.out.println(myReference.toString()); //myRemoteSearchApi = (IRemoteSearchApi)PortableRemoteObject.narrow(myReference, IRemoteSearchApi.class); myRemoteSearchApi = (IRemoteSearchApi)myReference; } catch (Exception e) { e.printStackTrace(); } /*Generates following exception:Proxy[Remote,RemoteObjectInvocationHandler[UnicastRef [liveRef: [endpoint:[172.17.152.77:1659](remote),objID:[0]]]]]java.lang.ClassCastException: $Proxy1 at as.multiplus.multisearch.backend.SearchApi.TestKeyMatcher(SearchApi.java:114) at as.multiplus.multisearch.backend.SearchApi.main(SearchApi.java:41)*/