Java策略文件无法为代码库jar分配权限

时间:2011-03-18 13:42:23

标签: java security permissions policy codebase

我编写了我的java策略文件,将allPermission提供给jar说“xyz.jar”

grant codebase "file:lib/xyz.jar" {
  permission java.security.AllPermission;
};

但是在执行程序时,我获得了属性权限的AccessControlException。此属性由jar中的类设置。

以下是进行策略调试的条目:

policy: evaluate codesources:
    Policy CodeSource: (file:/C:/path/lib/xyz.jar <no signer certificates>)
    Active CodeSource: (file:/C:/path/lib/log4j-1.2.9.jar <no signer certificates>)
policy: evaluation (codesource) failed

policy: evaluate codesources:

    Policy CodeSource: (null <no signer certificates>)
    Active CodeSource: (file:/C:/path/lib/xyz.jar <no signer certificates>)

policy: evaluate principals:

    Policy Principals: [com.abc.MyLoginModule/principalA]
    Active Principals: []

policy: evaluation (principals) failed

我哪里错了?

0 个答案:

没有答案