Three ways of Tomcat hot deployment

Hot deployment refers to modifying the JSP or JAVA class when you modify the project BUG, ​​so that the modification can take effect without restarting the WEB server. Except for the modification of configuration files! 

1. Put the project web folder directly in webapps.


2、在tomcat\conf\server.xml中的<host></host>内部添加<context/>标签: 
<Context debug="0" docBase="D:\demo1\web" path="/demo1" privileged="true" reloadable="true"/>

 

docBase: project path, you can use absolute path or relative path, relative path is relative to webapps 
path: the path to access the project, such as: http://127.0.0.1:8080/demo1 
reloadable: whether to automatically load new or changed classes File.debug 
property The verbosity of the debug information logged by the Logger associated with this Engine. The higher the number, the more detailed the output. If not specified, defaults to 0. That is, the level of detail written to the log file when the program is abnormal.


3. The third method is similar to the second method, but instead of adding the Context tag to the Server.xml file, 
add an XML file to %tomcat_home%\conf\Catalina\localhost,

Such as: demo1.xml, the content is as follows: 
<?xml version="1.0" encoding="UTF-8"?> 
<Context docBase="D:\demo1\web" reloadable="true" /> 
, but the path is missing Attribute, if you hard write a path="demo2", it is useless, tomcat does not clearly tell you: "I don't know", 
this way the server will use the name of the xml file as the name of the path attribute, SO access The address is: http://localhost:8080/demo1 

Guess you like

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