The role of the work folder in the Tomcat root directory

The role of the work folder in the Tomcat root directory

 

Original link: http://blog.csdn.net/naruto_ahu/article/details/8519555#comments

 

The work directory is just the working directory of tomcat, that is, the working directory of tomcat converting jsp to class file.

 

How Tomcat works :

 

When a browser accesses a jsp page, tomcat will convert the jsp page into a .java file in the work directory , for example, convert index.jsp into index_jsp.java file, and then compile it into an index_jsp.class file, and finally the tomcat container passes the The ClassLoader class loads the index_jsp.class class into memory and performs the work of responding to the client.

 

Tomcat will regularly scan the jsp files in the container and read the attributes of each file. When a jsp file is found to have changed (the last modification time of the file is different from the last scan), tomcat will re-convert and compile the file. jsp file. But the scan of tomcat is timed rather than real-time, which is why it takes a few minutes for the modified jsp to take effect after the jsp file is modified.

 

Of course, in order to take effect immediately, it is recommended to clear the files in the work directory immediately after modifying the jsp page .

Close Tomcat
, open the tomcat/work directory ,
delete the Catalina directory ,
and run Tomcat.

In fact, you can use the rm command to delete the entire directory:

->cd /opt/tomcat/work

->rm -rf *


Modify the path according to your actual situation
, so that every time you start Tomcat, the page cache will be deleted first, so you don't have to worry that the page is not recompiled after modification.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326458693&siteId=291194637