4

I have written my java policy file to give allPermission to a jar say "xyz.jar"

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

But while executing the program I get a AccessControlException for a property permission. This property is set by a class in the jar.

While doing the policy debugging following are the entries:

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

and

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

Where am I going wrong?

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Sanket Patel
  • 71
  • 1
  • 3
  • Try putting the full path to the jar file in your policy file. I'm not sure where it would be trying to find lib/xyz.jar relative to. – DaveH Mar 18 '11 at 13:56
  • "Where am I going wrong?" I would say at the very moment you decided to use policy files rather than digitally signing the code that needs to be trusted. The (damn) tutorials focus far too much on policy files. They are difficult for developers to get right, so no end user should be altering them. – Andrew Thompson Mar 18 '11 at 13:57
  • For an applet I maintined a year ago that required an "AllPermission" policy file to run reports, we actually had to email them the policy file with instructions on where to put it. It all felt truly wrong. They ALWAYS messed it up. – dseibert Mar 18 '11 at 18:16
  • @user53300 - Well the path is correct as shown in the debugging entries (did not mention the exact path in my query). – Sanket Patel Mar 21 '11 at 06:31
  • so did you ever get a solution for this? I am keen to know since I am facing a similar issue. Thanks. – topgun_ivard Dec 19 '12 at 23:31
  • @topgun_ivard if you have solution for this problem please share – satish Nov 30 '20 at 05:04

0 Answers0