Throw the right exception
Fix RPC for Java 7