How to develop a docbase path that you define when you deploy Tomcat

Source: Internet
Author: User

After installing Tomcat, I found that Tomcat was installed in the system and the path underground, each time the deployment is very troublesome, so you want to specify a custom application deployment path:

Here is how to specify, related documents please see https://tomcat.apache.org/tomcat-4.1-doc/appdev/deployment.html

Pay attention to your Tomcat version, I check online because my version is 7.0.6, and the deployment method has several versions, 3.1 and 4.1 is not the same

First of all, my own. 7.0. Version 6 is deployed by opening the root directory of Tomcat to modify the Server.xml file under the Conf folder to add a specified docbase path on the bottom </Host> tag

Context flag: If

<context path= "" docbase= "~/documents/javaproject/webapps/" reloadable= "true"/>

Note Two small details:

One is to specify docbase do not forget this docbase is a folder so as above WebApps to add/

The other one is docbase to have a Web-inf folder structure inside the structure and Tomcat is consistent with the WebApps under the directory.

This way your Java class and application-dependent jar packages can be placed under the Web-inf folder under Class and Lib, respectively.

Now let's talk about how the 3.1 version of Tomcat was made:

The 3.1 version of Tomcat also added the context flag, but the location was added in the Apps.xml under the Tomcatroot/conf folder, as it is possible that this file is not available under this folder

At this point you need to create a file like this and then add it to it.

  <?xml version= "1.0" encoding= "iso-8859-1"?>    <webapps> <context path= "" Docbase= "~/documents/ javaproject/webapps/"reloadable=" true "/>    </webapps>
That's good (because my version is 7.0.6, so I didn't try to succeed)

Add a few properties that can be specified by apps deployed with Tomcat (all configured with context flag)

Path: This is the one that specifies which web app to access
DocBase: Specify where the application you are publishing
Debug: Related to Tomcat log
Reloadble: Set to True,tomcat will automatically detect if there are new updates to the class file under your Web-inf/class or the jar package in Web-inf/lib. If so, Tomcat automatically shuts down and restarts the update after loading (presumably this is the case)

Trusted: Access to the Tomcat inner class (typically administrator-to-tomcat operations)

What a ghost translation is (see original:)
    • path. The context path for your application, which are the prefix of a request URI that tells Tomcat which application s Hould is used to process the this request. For example, if you set your path to "/catalog", the Any request URI beginning with "/catalog" would be processed by this appli cation. This attribute are requrired, and must start with a slash ('/') character.
    • docBase. The document root directory for this Web application. This can being a relative path (relative to the directory in which Tomcat was started), or an absolute path, to the directory Containing your app. On a Windows platform, you must use the drive prefix and a colon when specifying an absolute path. This attribute is required.
    • Debug. Debugging detail level (from "0" to "9") so defines how verbose Tomcat ' s logging messages would be when your application is initialized, started, and shut down. The default value is ' 0 ' (minimal logging) If you does not specify a different value.
    • reloadable. Set to ' true ' if you want Tomcat-to-watch for changes-Java class files in the Web-inf/classes directory, or JAR files I n the Web-inf/lib directory. If Such a change is noted, Tomcat would shut down and reload your application automatically, picking up these changes. The default value ("false") means that such changes would be ignored. Note:while This feature was very useful during development, it requires overhead to do the checking. This capability should generally is not being used in deployed production applications.
    • trusted. Set to "true" if the application requires access to TOMCAT 3.3 internal classes. Normally, this is only being required for the administration application that ships with Tomcat.





How to develop a docbase path that you define when you deploy Tomcat

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.