Tomcat – java.security.AccessControlException: access denied (java.lang.RuntimePermission accessDeclaredMembers)
Problem
As i said in previously post, Tomcat 5.5.25 made a lot of modification in policy file, which may enhance security on web application but it also causing a lot of problem, see another error message :
SEVERE: Context initialization failed java.security.AccessControlException: access denied (java.lang.RuntimePermission accessDeclaredMembers) at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
Solution
Policy file issue, vi 04webapps.policy, this file is usually located at policy.d folder
mkyong@mkyong-desktop:/etc/tomcat5.5/policy.d$ 04webapps.policy
add following statement into the policy file
permission java.lang.RuntimePermission "accessDeclaredMembers";For example,
File : 04webapps.policy
// JVM properties to allow read access permission java.util.PropertyPermission "java.version", "read"; permission java.util.PropertyPermission "java.vendor", "read"; //omitted for readability // Precompiled JSPs need access to this package. permission java.lang.RuntimePermission "accessClassInPackage.org.apache.jasper.runtime"; permission java.lang.RuntimePermission "accessClassInPackage.org.apache.jasper.runtime.*"; permission java.lang.RuntimePermission "accessDeclaredMembers"; };
Saved it, restart Tomcat and Done.
Well, it depends, in my case im deploying an application through JWS and i got that message. My app contains a web service client and i needed some jars to connect the server.
The problem was that the jnlp file was missing the section:
Of course, the jars are signed in order to run without problems. Once i added that instructions the exception gone.
Btw, I didn’t need to modify any policy file.
I dont know what happened with the code.
Just add the all-permissions tag inside security tag.
More info:
http://download.oracle.com/javase/tutorial/deployment/webstart/security.html
[...] java.security.AccessControlException: access denied (java.lang.RuntimePermission accessDeclaredMemb… [...]
this dosent work!!!