tomcat automatically loads changed class files without restarting

There are two ways to not restart Tomcat : hot deployment and hot loading .

Hot deployment: The container redeploys the entire project at runtime .

In such an environment, the entire memory will generally be emptied and reloaded. This method may cause problems such as loss of sessin. The problem has been solved in tomcat 6 and above. 


Hot reload: best used during debugging, so that the whole project doesn't load. Debug mode supports hot loading.

The container reloads compiled classes at runtime . In such an environment, the memory will not be emptied, and the sessin will not be lost, but it is easy to cause memory overflow, or find a way . Generally, there will be exceptions when changing the layout and model of the class, and there will be no problems in changing the existing variables and methods .


The hot reload configuration is as follows:
In tomcat's server.xml,

<Context docBase="my_cms" path="/my_cms" reloadable="true" debug="0"  
privileged="true" source="org.eclipse.jst.jee.server:my_cms"/>

path: Specifies the URL entry to access the web application.  
docBase: Specify the file path of the web application, either an absolute path or a relative path relative to the appBase attribute of <Host>. If the web application adopts an open directory structure, specify the root directory of the web application. is a war file, specify the path of the war file.  
reloadable: If this property is set to true, the tomcat server will monitor the changes to the class files in the WEB-INF/classes and WEB-INF/lib directories when it is running. If it detects that the class files are updated, the server will automatically reload Load the web application.

 

Guess you like

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