Why does my Tomcat server throw intermittent 404 when compiling JSP?

I need help figuring out why several of my web applications periodically throw 404 errors when trying to create a JSP. One of them has a JSP that is accessed directly, and the other a servlet that forwards the JSP. Pages work most of the time, but sometimes they will throw 404. If a user refreshes his browser 1-3 times, the page starts working again without any changes.

The following is an example of an error visible in a web browser (Chrome): type: Status report message: /app_root/my_page.jsp description: The requested resource is not available

The problem seems to be due to recompilation of JSP pages. The .war file and extended directory are not modified. There are always three errors in the logs corresponding to each 404 error: WARNING: Failed to delete generated class file [D:\Apache Software Foundation\Tomcat 7.0\work\Catalina\localhost\app_root\org\apache\jsp\my_005fpage_jsp.class] May 19, 2015 6:32:24 AM org.apache.jasper.compiler.Compiler removeGeneratedFiles WARNING: Failed to delete generated Java file [D:\Apache Software Foundation\Tomcat 7.0\work\Catalina\localhost\app_root\org\apache\jsp\my_005fpage_jsp.java] May 19, 2015 6:32:24 AM org.apache.jasper.compiler.Compiler generateJava WARNING: Failed to delete generated Java file [D:\Apache Software Foundation\Tomcat 7.0\work\Catalina\localhost\app_root\org\apache\jsp\my_005fpage_jsp.java]

I am running Java 1.7 on Tomcat 7.0.53. Tomcat runs on a Windows 2008 R2 server.

Here is what I have tried so far, based on the information I found from Google. However, 404 continues.

  • Disabled Windows indexing in the entire Tomcat directory
  • Disable development mode in my production environment
  • Increased TestInterval modification in my default QA environment (4 seconds) to 3600 (1 hour) [Note: it is currently set to 0 to help me reproduce the problem]
  • The owner in the Tomcat working directory has been changed as the same identifier as the identifier that runs in the service.

I run an antivirus that is disabled in the working directory to see if this helps.

While this problem occurs on my prod and QA servers, this does not happen for me on my local Tomcat instance. In fact, I have not yet seen a problem with my workstation, even when running QA and Prod applications. This question was seen only by other people.

+7
java jsp tomcat intermittent
source share
3 answers

I had the same problem after deploying .war on our real server. These are the steps that I followed to solve the problem:

1) Shut down tomcat server

2) Go to <your tomcat directory> -> work -> Catalina -> localhost -> <your project> -> org -> apache -> jsp ->

3) Manually delete both .class and .java

4) Delete the .war file and the expanded folder from the website with the problem in the webapps folder.

5) Export the new .war and put it in the webapps folder.

6) Start the tomcat service again.

Once the server completes the deployment, it will automatically recreate the deleted files in the "work" directory and the website will be accessible again without intermittent 404 error.

I hope this works for you too.

+2
source share

The Tomcat container caches the .java and .class files created by the JSP parser that are used by the web application. Sometimes they become damaged or cannot be found. This can happen after an update or an update that contains changes to the JSP.

The solution is to simply delete the working directory and restart tomcat

+2
source share

Check the permissions of this file or folder. Typically, this problem is caused by lack of access to folders.

+1
source share

All Articles