Several common ways to deploy Tomcat projects [tested]

Several common ways to deploy Tomcat projects [tested]

1 / Copy the web project files directly to the webapps directory

This is the most commonly used method. Tomcat's Webapps directory is Tomcat's default application directory. When the server starts, all applications in this directory will be loaded. If you want to change 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 a project in an IDE development environment.

The access path using this method is http://localhost:8080/webname

2/ Modify the Server.xml file

Find the Host tag in the server.xml file under conf and add the following code to it:

<Context path="/jfinal_demo" docBase="F:workjfinal_demoWebRoot" reloadable ="true" debug="0" privileged="true">
</Context>

  • path: is the root address when accessing, indicating the access path, which can be customized. For example, in the above example, the address to access the application is as follows: http://localhost:8080/jfinal_demo;
  • docbase: indicates the path of the application. docBase can use an absolute path or a relative path. The relative path is relative to webapps.
  • reloadable: Indicates that the class package can be automatically loaded in the classes and lib folders at runtime. This property is usually set to true during the development phase to facilitate development; it should be set to false during the release phase to increase the access speed of the application;

For other properties, see the relevant documentation.

3 / Add the xml configuration file in the confCatalinalocalhost directory

Create a new file named jfinal_demo.xml and configure the file content as follows:

 <Context path="/jfinal_demo" docBase="F:workjfinal_demoWebRoot" reloadable ="true" debug="0" privileged="true"> 
 </Context>

The Catalinalocalhost directory does not exist by default when Tomcat is downloaded. It will be created automatically when it is started for the first time, or it can be created manually.

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

The third method is recommended because it does not require modifying the default configuration of Tomcat, is the least invasive to Tomcat, and if you want to cancel the deployment, you can directly delete the XML configuration file.

The above methods have been tested by myself. In addition, there is also the Tomcat hot deployment method.

Summarize

The above are several common ways to deploy Tomcat projects introduced by the editor [personally tested]. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!

You may also be interested in:
  • Some problems encountered when deploying the springboot project into a war package and deploying it to tomcat
  • How to deploy a Web project in Tomcat (must read)
  • SpringBoot creates a web project and deploys it to an external Tomcat
  • Solve the problem that web project web page changes under tomcat deployment cannot be automatically refreshed
  • Detailed explanation of three methods of Tomcat deployment project
  • Detailed explanation of the basic steps to deploy the Web project War package to the Tomcat server
  • How to deploy a spring boot project into a tomcat container
  • Detailed explanation of CentOS installation of tomcat and deployment of Java Web projects
  • Tomcat 7 deploys two projects by setting different ports

<<:  Detailed explanation of views in MySQL

>>:  jQuery implements the mouse drag image function

Recommend

Basic usage knowledge points of mini programs (very comprehensive, recommended!)

Table of contents What to do when registering an ...

How to set PATH environment variable in Linux system (3 methods)

1. In Windows system, many software installations...

Linux system file sharing samba configuration tutorial

Table of contents Uninstall and install samba Cre...

Solve the problem after adding --subnet to Docker network Create

After adding –subnet to Docker network Create, us...

Install MySQL in Ubuntu 18.04 (Graphical Tutorial)

Tip: The following operations are all performed u...

What is JavaScript anti-shake and throttling

Table of contents 1. Function debounce 1. What is...

How to obtain and use time in Linux system

There are two types of Linux system time. (1) Cal...

Create a code example of zabbix monitoring system based on Dockerfile

Use the for loop to import the zabbix image into ...

A brief discussion on the placement of script in HTML

I used to think that script could be placed anywh...

Detailed explanation of map overlay in openlayers6

1. Overlay Overview Overlay means covering, as th...

Detailed explanation of Nginx current limiting configuration

This article uses examples to explain the Nginx c...

Detailed explanation of the process of building and running Docker containers

Simply pull the image, create a container and run...

Explore VMware ESXI CLI common commands

Table of contents 【Common commands】 [Summary of c...

js to achieve a simple magnifying glass effect

This article shares the specific code of js to ac...

Three networking methods and principles of VMware virtual machines (summary)

1. Brigde——Bridge: VMnet0 is used by default 1. P...