Tomcat through the Conf-catalina-localhost Catalog publishing project detailed

Source: Internet
Author: User
Tags tomcat server

Tomcat publishes the project in roughly three ways, but the side dishes think it is best to publish the project by adding a configuration file under the Tomcat's Conf/catalina/localhost directory.

Because this is the least intrusive for Tomcat, you just need to add a configuration file, do not need to modify the original configuration, and support dynamic resolution, modify the code to take effect directly (except to modify the configuration).

But the online introduction of this method is very simple, the side dishes to add.

    1. add a server directly to eclipse, and add a path that indicates tomcat in the process.

    2. Create an XML file under the Conf\catalina\localhost directory of the Tomcat server (the path cannot be found to create itself), as follows:

<context path= "/testpro" docbase= "D:\javaProject\TestPro\WebContent" debug= "0" privileged= "true" >

</Context>

where path refers to the project's publishing path, that is, access path, if like the above fill, it is necessary to visit: http://localhost:8080/TestPro/index.jsp;docBase Refers to the project's WebContent (Eclipse) or Webroot (myeclipse) directory, and it is well understood that your project is finally released, that is, the directory that is published, and by configuration, direct tomcat to the directory, so that you can run the project.

Note: XML the file name must be consistent with the publishing path. In this example, the XML file name must be: Testpro

    3. start Tomcat in Eclipse and the project starts.

The above is a more common usage, but many times we want to publish the project to the Tomcat root directory so that we can access it without entering a lengthy publishing path.

In this way, the project is published in the Tomcat root directory, the following considerations:

    1. For insurance purposes, delete the root folder in the WebApps directory in the Tomcat server.

    2. set the path in XML to Empty (path= "").

    3. change the XML file name to ROOT (Root.xml).

This allows you to publish your project to the Tomcat root directory, and hopefully this article will help.

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.