问题描述
我遇到ReflectPermission(suppressAccessChecks)的问题。每当我使用经过认证的用户(用户名和密码)登录并尝试访问我的Web应用程序中的.jsp或任何其他页面时,我都会得到
java.security.AccessControlException:访问被拒绝(java.lang.reflect.ReflectPermissionsuppressAccessChecks)
。
只有通过在GlassFish 安全属性中检查安全管理器启用时,才会发生这种情况。当我取消选中该选项时,Web应用程序可以正常工作。
我想知道是什么原因导致这个原因以及如何解决这个问题?我认为不建议在安全属性中取消选中安全管理器。
虽然我在GlassFish Security部分查看了安全管理器,在我的.jsp代码上添加以下代码
ReflectPermission refperm = new ReflectPermission(suppressAccessChecks,);
AccessController.checkPermission(refperm);
然而这也没有帮助。
$ b在tomcat7中解决了相同的问题
$ b
权限java.lang.reflect.ReflectPermissionsuppressAccessChecks;
授予权限。
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.
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.
这篇关于ReflectPermission(QUOT; suppressAccessChecks")的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!