More explicit error checking for JNI name lookup.