Learn how to deploy and start multiple tomcats and migrate projects in one article

Learn how to deploy and start multiple tomcats and migrate projects in one article

Sometimes when we are writing a web project, there are several projects that need to run at the same time, but there will always be various problems when placing the war package directly, such as deploying multiple projects on the same Tomcat and the same port, or deploying multiple projects on multiple ports of the same Tomcat. After several tests, I decided to share it with you. I won’t talk much about the installation of JDK. Just configure the environment variables. Here is a detailed operation process for you:

Deploy tomcat

1. Download and decompress

Download tomcat from the official website and decompress it

2. Modify the configuration file

Open the conf directory

Modify the server.xml file to change the http access port (the default is port 8080)

<Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" URIEncoding="UTF-8"/>

  <Connector executor="tomcatThreadPool"
               port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443"/>

Can be modified as (for reference only, according to personal needs):

<Connector port="8088" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" URIEncoding="UTF-8"/>

  <Connector executor="tomcatThreadPool"
               port="8088" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443"/>

Change 8080 to the port number that is no longer in use by the first tomcat. The port number set here is the port number used to access the web in the future.

Change the shutdown port (the default is port 8005)

<Server port="8005" shutdown="SHUTDOWN" debug="0">

Can be modified as (for reference only, according to personal needs):

<Server port="8095" shutdown="SHUTDOWN" debug="0">

Change 8005 to a port number that is not in use

(3) Change the JVM startup port (the default is port 8009)

<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

Can be modified as (for reference only, according to personal needs):

<Connector port="8099" protocol="AJP/1.3" redirectPort="8443" secretRequired="" />

Remember to uncomment this line. It is very important to add the configuration of secretRequired="" here, otherwise you will report the error org.apache.catalina.LifecycleException: The protocol processor failed to start! ! !

Change 8009 to a port number that is not in use

Modify logging.properties

To solve the problem of garbled Chinese output in the tomcat console

Change utf-8 in logging.properties to GBK

Running Tests

insert image description here

Transplantation Project

1. Packaging the original project

If it is a Maven project, first click the following command to execute install

insert image description here

Then, go to the directory of your Maven repository and find the package (if you don’t know your repository directory, you can go there)

As shown

insert image description here

Next, copy this package

insert image description here

2. Copy to tomcat

Then paste it under tomcat's webapps, as shown below

insert image description here

In this way, after Tomcat runs, it will automatically decompress it for you

3. Visit and try

insert image description here

Finish! ! !

The above is the detailed content of how to deploy and start multiple tomcats and transplant projects. For more information about tomcat deployment and startup, please pay attention to other related articles on 123WORDPRESS.COM!

You may also be interested in:
  • How to implement hot deployment and hot start in Eclipse/tomcat
  • Solution to the problem that eclipse deploys tomcat server and cannot start
  • Solution to the problem that SpringBoot application cannot be started when deployed to Tomcat

<<:  An article to teach you HTML

>>:  MySql development of automatic synchronization table structure

Recommend

Solution to the problem that Docker cannot stop or delete container services

Preface Today, a developer gave me feedback that ...

Detailed explanation of important cascading concepts in CSS

Recently, I encountered a problem in the process ...

Secondary encapsulation of element el-table table (with table height adaptation)

Preface During my internship at the company, I us...

What is flex and a detailed tutorial on flex layout syntax

Flex Layout Flex is the abbreviation of Flexible ...

Use a table to adjust the format of the form controls to make them look better

Because I want to write a web page myself, I am al...

Summary of common commands in Dockerfile

Syntax composition: 1 Annotation information 2 Co...

How to handle images in Vue forms

question: I have a form in Vue for uploading blog...

How to mount a data disk on Tencent Cloud Server Centos

First, check whether the hard disk device has a d...

Some common mistakes with MySQL null

According to null-values, the value of null in My...

MySQL 8.0.24 version installation and configuration method graphic tutorial

This article records the installation and configu...