Several ways Tomcat deploys a Java Web project

Source: Internet
Author: User

When I was studying, I learned that it was embarrassing to publish the project to Tomcat in Eclipse or myeclipse, and then actually deploy the project on the server, so I learned how to do it, so I took a note of how Tomcat published the project.

1 Copy the Web project file directly into the WebApps directory

This is the most common way, Tomcat's WebApps directory is the Tomcat default application directory, and when the server starts, it loads all applications under this directory. If you want to modify this default directory, you can modify the AppBase value in the host tag in the Server.xml file under Conf.

This method is actually the same as deploying the project in the IDE development environment.

The access path with this method is Http://localhost:8080/webname

2 Modify Server.xml File

  Locate the host tag in the Server.xml file under Conf, and add the following code:

Path: is the root address of the access, indicating the path of access, can be customized, as in the above example, access to the application address is as follows: Http://localhost:8080/jfinal_demo;

Docbase: Represents the path of the application, Docbase can use absolute paths, or relative paths, relative paths relative to WebApps;

Reloadable: Indicates that the class package can be loaded automatically at run time under the classes and Lib folders. This property is usually set to true in the development phase to facilitate development, and should be set to false in the release phase to increase the access speed of the application;

See related documentation for additional properties.

3 Adding an XML configuration file under the Conf\catalina\localhost directory

Create a new file named Jfinal_demo.xml, and the file content is configured as follows:

1 <context path= "/jfinal_demo" docbase= "F:\work\jfinal_demo\WebRoot"  

Catalina\localhost directory tomcat download down default is not, the first boot will be created automatically, or can be created manually;

The Path property can be removed from the configuration because the root path for accessing the project depends only on the name of the XML file, as in the above example, access to the application address is as follows: Http://localhost:8080/jfinal_demo;

The third approach is recommended because you do not need to modify the tomcat default configuration, have minimal intrusion on Tomcat, and if you want to Undeploy, delete the XML configuration file directly.

Several ways Tomcat deploys a Java Web project

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.