TOMCT problem-webapps The root directory of the extra

Source: Internet
Author: User

The problem occurs in the background :

Because the company's web environment is mostly tomcat, there are small issues in the project release in order to quickly resolve the need to manually add or modify the contents of the war package after decompression. But in the modification of some webapps in addition to the war package extracted after the package file, there will be more than one root folder, and development will usually tell me: do not forget to change the contents of root.

Why, why do you want to change the content of root?


The following first explains the role of the root in Tomcat under WebApps


the role of the root directory in Tomcat under WebApps :

When we finished deploying Tomcat when we were learning Tomcat, we typically entered the ip:8080 default port with a Tomcat welcome interface, which is in root webapps.

General Tomcat access is in the form of "IP: Port/Package name "

But the role of root is to save the package name so that access to the Tomcat War package project requires only "IP: Port ", which simplifies the configuration of the reverse generation. No reverse proxy is required to write the dead package name, which eliminates the need to modify the reverse proxy when replacing the project. To a certain extent, reduce the workload of OPS personnel.


How does the root directory appear?

At first, because of the ignorance of Tomcat, so the emergence of root is very confusing, why each release before I delete root, after the release root always appear again. Before you need to make small-scale changes to a post-release project, you don't know why you want to change the root. Not until now. Why do I have to change root when I make changes to a post-release project?

The meaning of root is mentioned earlier, it simplifies the URL of the access, and does not have to make additional modifications to the reverse proxy when the project package name changes.

The presence of root is related to the Conf/server.xml configuration file

An additional configuration in the Server.xml file is

<context path= "" reloadable= "true" docbase= "/deploy/to/war"/>

Docbase can be the path to the war package or the path to the folder name after the war package is unzipped

Xxx.war Form

<context path= "" reloadable= "true" docbase= "/opt/xxx.war"/>

For example Xxx.war under/OPT, Docbase can be written docbase= "/opt/xxx.war", at this time Tomcat started, in the engine's default WebApps will generate a folder named Root, Within this folder is the content of Xxx.war decompression.

A message can be found by viewing the log

DEBUG [Localhost-startstop-1]-Published root webapplicationcontext as ServletContext attribute with name [Org.springfra Mework.web.context.WebApplicationContext.ROOT]

The main idea: to publish the contents of the defined package in ServletContext to the root folder.

xxx Folder form

<context path= "" reloadable= "true" docbase= "xxx"/>

Note: Docbase has absolute path and relative path, relative path is relative to engine engines definition WebApps

If the path specified by Docbase is in the form of a Xxx.war package, you need to place the Xxx.war under WebApps , which is roughly the following process: Tomcat first extracts xxx.war to xxx files, then copies the xxx folder to a new folder named Root .


Summarize:

The way that Tomcat accesses the IP: Port way to access the war package project is more convenient, and I recommend doing so. However, remember to delete the root folder when you publish, or you will find that you publish after the release of no changes, if a small issue after the release needs to be resolved quickly, it is necessary to modify the content of root rather than the extracted war package content.

Now I know that the development notification tells me that only half is correct, that is, change root!.


What I write is not necessarily all right, but after experimental verification, there is no error, if there is a wrong to say welcome correct.


Resources

http://blog.163.com/[email protected]/blog/static/1715817120071015115620650/

Http://blog.knowsky.com/206846.htm

This article is from "Zhang Fan-it's fantasy drifting" blog, please be sure to keep this source http://chawan.blog.51cto.com/9179874/1947201

TOMCT problem-webapps The root directory of the extra

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.