Warren Nocos
Warren Nocos

Reputation: 1272

JSP - java.security.AccessControlException: access denied

I am new to JSP deployment. My JSP project includes file uploading to the database using Hibernte. It all went well on my local machine. But whenever I run it online, I'm getting the following exception:

java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessClassInPackage.org.apache.tomcat.util.http.fileupload").

Here is the full stacktrace:

org.apache.jasper.JasperException: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessClassInPackage.org.apache.tomcat.util.http.fileupload")
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:549)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    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(NativeMethodAccessorImpl.java:57)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    java.lang.reflect.Method.invoke(Method.java:601)
    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(Subject.java:536)
    org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:306)
    org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:166)
root cause java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessClassInPackage.org.apache.tomcat.util.http.fileupload")
    java.security.AccessControlContext.checkPermission(AccessControlContext.java:366)
    java.security.AccessController.checkPermission(AccessController.java:555)
    java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
    java.lang.SecurityManager.checkPackageAccess(SecurityManager.java:1529)
    sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:305)
    java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1616)
    org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1546)
    org.apache.jsp.register_jsp._jspService(register_jsp.java:99)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    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(NativeMethodAccessorImpl.java:57)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    java.lang.reflect.Method.invoke(Method.java:601)
    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(Subject.java:536)
    org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:306)
    org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:166)

By the way, I deployed my app on eatj.com. Please help me in getting rid of this error. Thanks

Upvotes: 0

Views: 940

Answers (1)

Thirumalai Parthasarathi
Thirumalai Parthasarathi

Reputation: 4671

I believe that the hosting server doesn't allow files to be uploaded. That is what the exception indicates. You dont have enough privileges to upload files on the server

Upvotes: 1

Related Questions