0

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

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

5 Comments

Thanks. Is there a good JSP hosting out there that is free for testing, and also enables file uploading?
May i know why you would want to do that..?
Final requirement for one of my subjects, School stuff.
I am not sure if web hosting servers will give you permissions for uploading files. Because, a web server is different from a file server. Web server serves web pages but a file server allows storage and retrieval of files.Two are built for different purposes and i dont think you can get them for free
The webapp is programmed to let users upload files to the MySQL database using Hibernate. It all went well in my local machine using Tomcat. By the way, the web hosting site eatj.com where this webapp is hosted permits modification of the Tomcat server's settings, except the JVM's heap size. Is there a way to change the Tomcat server's settings to default?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.