How to deploy Java Web applications in tomcat

Source: Internet
Author: User


There are several ways to deploy a Java Web application in tomcat:

#PetWeb是工程名1. In the host node of the Tomcat_home\conf\server.xml file, add
<context docbase= "F:/workspaces/petweb" reloadable= "false" path= "/pet"/>
where reloadable= "false" means that the server does not automatically load after the content in the application is changed, and this property is usually set to true during the development phase, which is easy to develop, and should be set to false in the release phase to increase the access speed of the application. Docbase is a path, you can use an absolute path, or you can use a relative path relative to the WebApps. The value of the Path property is the root address of the access. The access address is as follows: http://localhost:8080/Pet/

2. Add an XML file in Tomcat_home\conf\catalina\localhost, such as Pet.xml, as follows:
<context docbase= "F:/workspaces/petweb" reloadable= "false"/>
You may find that the second approach is the same, but the path attribute is missing, and the server uses the name of the. Xml as the value of the Path property. The access address is as follows: http://localhost:8080/Pet/

3. In the Tomcat_home\conf\server.xml file, add a host node, you can copy the localhost name of the host node, the host node Name property to another name, and then the tomcat_home\conf\ Catalina Create a folder named the name of the new host node, and then create a root.xml file in the folder with the following contents:
<context docbase= "F:/workspaces/petweb" reloadable= "false" path= "/pet"/>

PS:when configuring the Path property of the context, the paths that need to be configured cannot be in Chinese and Tomcat does not support
Reference article:
http://blog.163.com/ribbonchen/blog/static/118316505201071510386736/

How to deploy Java Web applications in 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.