The so-called hot deployment (hot release) (hereinafter referred to as "Hot deployment"), that is to say, after the web project is released, it is inevitable that you will encounter the problem of modifying bugs. The current hot deployment aims to solve this problem. Its function is to modify the JSP and Java classes without stopping the web service, the modified results can also be displayed on the page. Reduces debugging time and improves efficiency. However, modifying the configuration file is an exception. If you modify the configuration file, you must restart the web service.
Common web servers are Tomcat and JBoss.
1. Tomcat hot deployment
There are two methods to support hot deployment in Tomcat (in principle, the two methods are the same, but the positions are different)
A) define an XML file in catalina_base/CONF/Catalina/localhost/According to manager. xml. For example, if my project is called sodoperation, we can write a sodoperation. xml file with the following content:
<Context Path = "/sodoperation" docbase = "D:/myportal/sodoperation/src/webapp"/>
Here, path refers to the name of your project in Tomcat. Just like Manager, docbase refers to the web directory of your project. Until the welcome page (the previous directory of web-INF ). But in general, it is better not to have Chinese characters in this directory. If so, you can add them in the file.
<? XML version = '1. 0 "encoding = 'utf-8'?> To try, that is, the entire file is changed:
<? XML version = '1. 0 "encoding = 'utf-8'?>
<Context Path = "/sodoperation" docbase = "D:/myportal/sodoperation/src/webapp"/>
In this way, if this advertisement is used and the deployment of myeclipse is used, do not remove it easily. This will delete all files and will not last long. Therefore, the second method is recommended.
B) The second method is the same as the first method in principle. The difference is that the location is different. This time, add server. XML in catalina_base/conf to the end of the file:
<Context Path = "/sodoperation" docbase = "D:/myportal/sodoperation/src/webapp"/>
As mentioned above, after Tomcat is started, a file with the first method will be added to catalina_base/CONF/Catalina/localhost. This ensures that, as long as server. XML is not modified, you can delete newly generated files at will, and there is no problem with hot deployment.
2. JBoss hot deployment
There are also two hot deployment methods in JBoss. Because jobss integrates tomcat, it can be said that the two methods are modified on jobss.
A) Modify jboss-4.0.4RC1/Server/default/deploy/jbossweb-tomcat55.sar/context. xml
<Context cookies = "true" crosscontext = "true" antiresourcelocking = "true" antijarlocking = "true">
<Manager pathname = ""/>
<Instancelistener> org. JBoss. Web. tomcat. Security. runaslistener </instancelistener>
</Context>
Add the red part, restart JBoss, and use the myeclipse redeploy project. You don't need to restart it. After deployment, open a browser to preview it.