Tomcat multi-version war Application Deployment (instance description)

Source: Internet
Author: User
Preface

At the beginning of Tomcat 7, Tomcat supports multi-version application deployment. This feature is very good, especially in the production environment. You do not need to restart tomcat to upgrade the application. The upgrade process does not affect your business. The hot upgrade feature can only be achieved by a few top-level commercial middleware.

 

Parallel deployment of Tomcat

At the beginning of Tomcat 7, you can deploy multiple different versions of Web applications with the same context path at the same time. Currently, only Tomcat Manager can useWar file to deployTo achieve simultaneous deployment of multiple versions. The war package name can only beContext. War,Context # 2.war,Context #3. War and so on.

When you use http: // localhost: 8080/context for access, the rules are as follows:

If the current request does not contain session information, use the latest war application version.

If the current request has a session, use the war application version corresponding to the session.

If the current request has session information but the corresponding war application version cannot be found, use the latest war application version.

 

 

Use instance

As a developer, I developed a web application. A Web application is a war package with an index. jsp in it, which simply executes out. Print ("JSP Hello 1 "). After the project is developed, the Web application is packaged as MyApp ##1.war.

Access http: // localhost: 8080/manager/->Deploy->War file to deploy->Select war file to upload-> select MyApp #1. War-> click deploy

After the upload is successful, you can seeApplications adds a path named MyApp,An application whose version is 1.

Use the Google browser to access http: // localhost: 8080/MyApp/index. jsp. the JSP Hello 1 page is displayed.

As the requirement changes, you need to change the page display to JSP Hello 2.CodeThen, package the web application MyApp ##2.war.

Re-upload. You can see that the application adds an application whose path is MyApp and version is 2.

Use the Google browser to access http: // localhost: 8080/MyApp/index. JSP, you can see that the page displays JSP Hello 1 (because the session information corresponds to the application of version 1, we still access the application of version 1)

Then open the Firefox browser and access http: // localhost: 8080/MyApp/index. jsp. the JSP Hello 2 page is displayed. (because there is no session information, access the latest version of the application)

 

 

Related Article

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.