developer
developer

Reputation: 9478

AccessControlException when opening Tomcat 7's admin console

when iam just opening the admin console of tomcat 7.0 by this url, iam getting below exception

http://localhost:8085/

java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessClassInPackage.org.apache.jasper")
    java.security.AccessControlContext.checkPermission(Unknown Source)
    java.security.AccessController.checkPermission(Unknown Source)
    java.lang.SecurityManager.checkPermission(Unknown Source)
    java.lang.SecurityManager.checkPackageAccess(Unknown Source)
    sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    java.lang.ClassLoader.loadClass(Unknown Source)
    java.lang.ClassLoader.loadClass(Unknown Source)
    org.apache.jasper.servlet.JspServletWrapper.<init>(JspServletWrapper.java:120)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    java.lang.reflect.Method.invoke(Unknown Source)
    org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:274)
    org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:271)
    java.security.AccessController.doPrivileged(Native Method)
    javax.security.auth.Subject.doAsPrivileged(Unknown Source)
    org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:306)
    org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:166)

Please can anyone suggest how to resolve the above issue.

Upvotes: 0

Views: 1690

Answers (2)

ishan
ishan

Reputation: 1099

Change the permissions to your webapp in the file /etc/tomcat6/policy.d/04webapps.policy

Add this->

grant codeBase "file:${catalina.base}/webapps/<name of your webapp>/-" {
  permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
  permission java.security.AllPermission;
};

It worked for me. Hope it helps!

Upvotes: 1

Mark Thomas
Mark Thomas

Reputation: 16615

Don't run with a security manager or restore the default set of permissions ($CATALINA_BASE/conf/catalina.policy in a standard install). A default Tomcat install will work wth or without a security manager.

Upvotes: 1

Related Questions