问题
I'm having problem with ReflectPermission("suppressAccessChecks"). Whenever I login with authenticated user (user name and password) and try to access a .jsp or any other page in my web application I get
java.security.AccessControlException: access denied ("java.lang.reflect.ReflectPermission" "suppressAccessChecks")
.
This happens only when I have "Security Manager" enabled by checking it in GlassFish Security properties. When I uncheck this option the web application works.
I would like to know what causes this reason and how to solve it? I think it is not recommended to uncheck Security Manager in Security properties.
While I have checked Security Manager in GlassFish Security section, I tried to add following code above my .jsp code
ReflectPermission refperm = new ReflectPermission("suppressAccessChecks", "");
AccessController.checkPermission(refperm);
However that didn't helped either.
回答1:
I am not sure about the glassfish server but, i fixed the same issue in tomcat7 by editing the catalina.policy file and adding the line
permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; under grant permissions.
来源:https://stackoverflow.com/questions/16791237/reflectpermissionsuppressaccesschecks