Looking at the Tomcat source code for a while, I have been curious why there is a difference between CATALINA_HOME and CATALINA_BASE:
The concepts of CATALINA_HOME and CATALINA_BASE are to solve such scenarios:
You need to deploy multiple Tomcat instances on a single machine, but you don't want to create multiple copies of Tomcat, in other words, let these Tomcat copies have their own working directory but share Tomcat code.
The official documentation on CATALINA_HOME and CATALINA_BASE explains it like this:
- Throughout the docs, you'll notice there are numerous references to $CATALINA_HOME. This represents the root of your Tomcat installation. When we say, "This information can be found in your $CATALINA_HOME/README.txt file" we mean to look at the README.txt file at the root of your Tomcat install. Optionally, Tomcat may be configured for multiple instances by defining $CATALINA_BASE for each instance. If multiple instances are not configured, $CATALINA_BASE is the same as $CATALINA_HOME.
The translation is that CATALINA_HOME is the installation directory of Tomcat, and CATALINA_BASE is the working directory of Tomcat
CATALINA_BASE is related to each Tomcat instance, let's play the scenario described above together
The next zip release of Tomcat can be downloaded here: http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.69/bin/
Unzip it to the F drive, and then create two new directories named tomcat ins1 and tomcat ins2
Copy the shared folders of Tomcat to tomcat ins1 and tomcat ins2 respectively, there are
then in
Then create startup.bat in the folder of tomcat ins1
The contents of the file are as follows:
- set "CATALINA_BASE=%cd%"
- set "CATALINA_HOME=F:\apache-tomcat-7.0.69"
- set "EXECUTABLE=%CATALINA_HOME%\bin\catalina.bat"
- call "%EXECUTABLE%" start
Then we can modify the http port number to 7070 in server.xml in conf under tomcat ins1
The practice of tomcat ins2 is the same as that of tomcat ins1, but the port number is changed to 9090
Double-click startup.bat respectively
Then visit Tomcat and you will see:
\
Source: https://blog.csdn.net/jiaotuwoaini/article/details/51455829