ReflectPermission(“suppressAccessChecks”)

好久不见. 提交于 2020-01-16 09:24:29

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!