• Post Reply Bookmark Topic Watch Topic
  • New Topic

java.security.AccessControlException

 
Saranya Sivakumar
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

While executing my application through servlets i'm getting this error

java.security.AccessControlException: access denied (java.lang.RuntimePermission createClassLoader)

I tried to add this in C:\Program Files\Java\jdk1.6.0_20\jre\lib\security\java.policy

permission permission java.lang.RuntimePermission "createClassLoader";
java.util.PropertyPermission "NLS_LANG", "read";

but getting this error


java.security.policy: error parsing file:/C:/Program%20Files/Java/jdk1.6.0_20/jre/lib/security/java.policy:
line 52: expected [;], found [java.lang.RuntimePermission]

Please help me in solving this error.
Thanks.
 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are these inside of a "grant ... { ... }" block?

(I assume that the first line has two "permission", and the second has one, is just a copy/paste error.)
 
Saranya Sivakumar
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried with this

permission java.lang.RuntimePermission "createClassLoader","read";
permission java.util.PropertyPermission "NLS_LANG", "read";

and with inside grant also, but still facing the same problem...
Can you please say me how to give permissions in java.policy


Thanks.
Sary

 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So the parsing error is fixed now? That's a good first step. Now post the entire grant block.

Note that the servlet container may have its own security policy that overrides the JRE-wide policy. For example, Tomcat uses the one in TOMCAT_HOME/conf/catalina.policy, not the file that vou've been modifying.
 
Saranya Sivakumar
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply

here is the code

grant codeBase "C:\Program Files\Java\jdk1.6.0_20\jre\lib\security\java.policy"
{
permission java.lang.RuntimePermission "createClassLoader","read";
permission java.util.PropertyPermission "NLS_LANG", "read";
};
 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where did you get the idea that the parameter to "grant codeBase" is the policy file itself? It's the code that you wish to assign these permissions to; see http://download.oracle.com/javase/1.5.0/docs/guide/security/PolicyFiles.html for an introduction to security policies. You really need a solid understanding in what's going on; security is too important a subject to just try out things until something works.

And, to reiterate, you ARE making these changes to whatever policy file that governs the servlet container, right?
 
Saranya Sivakumar
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ya...

thanks a lot.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!