Java Development, Tomcat implementation hot deployment, to avoid every change in the code to restart

Source: Internet
Author: User
Original two Mao five brother 2017-03-19 23:54

Hot deployment is the modification of a JSP or Java class when you modify a project bug without restarting the Web server to make the changes effective (except for changes to the configuration file).

If you are using the latest version of MyEclipse or the IntelliJ idea Editor, there is no hot-deployment problem, and powerful mind has been configured for you. If you don't configure, look at the image below.

The configuration of Idea

Then we're talking about your company's eclips or other editors, so look at the bottom.

1, directly put the Project Web folder in the WebApps.

2, in the Tomcat\conf\server.xml

<context debug= "0" docbase= "D:\demo1\web" path= "/demo1" privileged= "true" reloadable= "true"/>

Reloadable= "true" to False (reloadable= "false")

3, the third Way and the second kind of similar, but not in the Server.xml file to add a context tag, but in the

Add an XML file to the%tomcat_home%\conf\catalina\localhost

such as: Demo1.xml, the contents are as follows:

<?xml version= "1.0" encoding= "UTF-8"?>

<context docbase= "D:\demo1\web" reloadable= "true"/>

, just missing the path attribute, and if you're writing a path= "Demo2", it's no use, and Tomcat doesn't explicitly tell you: "I don't Know",

This way the server uses the name of the XML file as the name of the path attribute, so the access address is: Http://localhost:8080/demo1

I often use the second type. I use ecleps when most of the development, accounting for less memory, running fast, mainly the interface is simple, with the habit. The first thing you can do when you finish a new project is Server.xml reloadable= "true" to false.

If you want to be more simple, you can also configure the Eclipse plug-in: Jrebel, the configuration is very simple, I search it, I do not wordy.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.