Detail the tomcat hot deployment and hot loading methods

  • 2020-06-19 12:13:54
  • OfStack

Detail the tomcat hot deployment and hot loading methods

During the development of the project, I often make changes to the Java/JSP files, but I don't want to restart the server (it takes time to restart the server), I want to get the (debug) results directly.

1. Hot loading: at ES9en. xml - > reloadable="true" in the context property


<Context docBase="xxx" path="/xxx" reloadable="true"/> 

2. Hot deployment: in ES18en. xml - > autoDeploy="true" in the context property


<Context docBase="xxx" path="/xxx" autoDeploy="true"/> 

You can also:

Code copy code collection code


<Host name="localhost" appBase="webapps" 
      unpackWARs="true" autoDeploy="true" 
      xmlValidation="false" xmlNamespaceAware="false"> 
<Context docBase="xxx" path="/xxx"/>  
</Host> 
 

3. The difference between:

Hot loading: The server will listen for changes in class files, including ES36en-ES37en /class, ES39en-ES40en /lib, ES42en-ES43en/web.xml and other files. If changes occur, the server will partially load the files without clearing session or freeing the memory. Development USES a lot, but you have to consider the memory out of the situation.

Hot deployment: The entire project is redeployed, including you retyping the.war file. session will be cleared, freeing up memory. It's used a lot in project packaging.

Modifications to the above configuration file can also be made through Settings on Eclipse

Right click on Eclipse project name: properties- > Tomcat- > General- > Make this as reloadable(reloadable="true") do not select Eclipse project name right click :Tomcat project- > Update Context Definition

The above is a detailed explanation of tomcat hot deployment and hot loading two methods and the difference, if you have any questions, please leave a message or to this site community exchange discussion, thank you for reading, hope to help you, thank you for your support to this site!


Related articles: