Make AccessibleObject Accessible
import java.lang.reflect.AccessibleObject; import java.security.AccessController; import java.security.PrivilegedAction; public class Utils { public static void makeAccessible( final AccessibleObject object ) { if (!object.isAccessible()) { if (System.getSecurityManager() == null) { object.setAccessible(true); } else { AccessController.doPrivileged(new PrivilegedAction<Object>() { public Object run() { object.setAccessible(true); return null; } }); } } } }