Home > Blockchain >  java.io.FileNotFoundException: /opt/tomcat/work/Catalina/localhost/ROOT/org/apache/jsp/index_jsp.cla
java.io.FileNotFoundException: /opt/tomcat/work/Catalina/localhost/ROOT/org/apache/jsp/index_jsp.cla

Time:11-17

when I run the application it shows an error of 500

I checked the path, it exists but shows permission denied

where can I check those permissions and how can I enable

the error is given below, I'm new to this can anybody tell how can i sort this

    Root Cause

java.io.FileNotFoundException: /opt/tomcat/work/Catalina/localhost/ROOT/org/apache/jsp/index_jsp.class (Permission denied)
    java.io.FileInputStream.open0(Native Method)
    java.io.FileInputStream.open(FileInputStream.java:195)
    java.io.FileInputStream.<init>(FileInputStream.java:138)
    sun.misc.URLClassPath$FileLoader$1.getInputStream(URLClassPath.java:1397)
    sun.misc.Resource.cachedInputStream(Resource.java:77)
    sun.misc.Resource.getByteBuffer(Resource.java:160)
    java.net.URLClassLoader.defineClass(URLClassLoader.java:460)
    java.net.URLClassLoader.access$100(URLClassLoader.java:74)
    java.net.URLClassLoader$1.run(URLClassLoader.java:369)
    java.net.URLClassLoader$1.run(URLClassLoader.java:363)
    java.security.AccessController.doPrivileged(Native Method)
    java.net.URLClassLoader.findClass(URLClassLoader.java:362)
    org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:129)
    org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:58)
    org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:192)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:413)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:379)
    org.apache.jasper.servlet.JspServlet.init(JspServlet.java:135)
    org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542)
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
    org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:687)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357)
    org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:382)
    org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
    org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:893)
    org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1726)
    org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
    org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
    org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    java.lang.Thread.run(Thread.java:748)

CodePudding user response:

You check the permissions on the file system.

I've seen such errors happen when Tomcat was once started as root (don't do that, ever), did write some temporary files (that now belong to root) and is later started as an unprivileged user (as it should be).

The unprivileged user can't overwrite (or not even read) root's files but needs to do that - and that's signaled through "Permission denied".

Check which unprivileged user your Tomcat is running as, and make sure that all temporary files (typically directories work, temp, logs) belong to this user and are readable and writable, including all files in them.

  • Related