Configure two or more Tomcat startup methods under windows

  • 2020-05-13 03:59:14
  • OfStack

Make sure CATALINA_HOME and CATALINA_BASE are not found in the environment variables for window

Modify server.xml to use the unzipped version of tomcat, not the installed version.

1. Modify the http access port

The service access port of the server.xml file under conf, which by default is 8080, can be changed to something else, such as 7000

2. Modify shutdown port

The default is 8005

3. Modify the jvm startup default port, and the default port is 8009 < br > < Connector port="8009" protocol="AJP/1.3" redirectPort="8443" / > I'm gonna change it to another port

Windows - my view of installing and simultaneously starting multiple Tomcat services on a single machine

Background:

What do we do if we need to deploy a beta web application to tomcat on a machine that has tomcat installed several times and that also runs one of the more important web applications? Obviously, you can't simply put the test project on top of the important web applications, because the crash of the beta will make the other applications fail at the same time, since they are running on the same JVM. This will require installing an Tomcat service to run the web beta application separately! (searched countless articles on the Internet, and finally saw the initial results after repeated tests)
tomcat installation package:

Download address: http: / / tomcat apache. org/index html
Download content: linux version of tomcat must be downloaded, not windows version!!!!!!!!! (http: / / apache. mirror. phpchina. com/tomcat/tomcat - 6 / v6. 0.18 / bin/apache - tomcat - 6.0.18. zip)
The original tomcat1 version of the server is windows, so there is no need to uninstall it. (in order to ensure the normal operation of the original service)

Here's why:

The reason you can't use the windows version of the package installation is that the name of the service must be unique and cannot conflict. Each time you install windows version of tomcat, the same service name will be used. The second installation will overwrite the first installation of the service! (the second time you install it, you will find that the environment configuration is the same no matter which service you start, even if the directory is different.)
Using the linux version (green version) is the process of manually configuring the name of the service, environment variables, etc., so that the two tomcat will not conflict

Start installation:

Unzip the tomcat installation package and move it to the directory you want.
Modify the conf/ server.xml file to modify all the ports involved in the location so as not to conflict with the installed tomcat service port on the server.


To find the 8080 , modified to 8081 ; To find the 8443 , modified to 8543 ; To find the 8009 , modified to 8019 ;
To find the 8005 , modified to 8015 ; To find the 8082 , modified to 8182

Write and execute InstallService.bat (any directory) batch files.


set JAVA_HOME=d:/Program Files/Java/jdk1.6.0_02
set CATALINA_HOME=D:/tomcat6
D:/tomcat6/bin/service.bat install myTomcat6

myTomcat6 is a self-defined service name. Do not use special symbols such as dots or underscores or subtractions in service naming to avoid unsuccessful service registration.
Specifying JAVA_HOME allows tomcat6 to use its own jdk. If not specified, jdk in the environment variable is used
System command line, enter services.msc, open Windows service manager, you can see the installed service myTomcat6, right click, start it.
d: / tomcat6 bin/service bat remove myTomcat6 can delete registered service.

Experience sharing:

The linux version of tomcat has a number of batch files in the bin directory, among which *.bat files can be executed under windows, while *.sh files are executed under linux.
We will find that linux version tomcat also has tomcat6.exe, tomcat6w.exe files in bin directory. Do not open it, modify the configuration 1, and then start the service.
tomcat6.exe, tomcat6w.exe will automatically open the service named "tomcat6" (the same is true for other versions of tomcat). If you execute these two files correctly, it will find a service named "tomcat6" (if the server was originally tomcat5, you will be lucky). No matter how you change the configuration, it is for the tomcat6 service, not for the "myTomcat6" service at all. (I made a mistake and the server's original tomcat service crashed at 5555555)

Set the memory used by JVM: it is known to all that tomcat6w.exe can be configured in the popup configuration screen after installation of windows version 1. But for our linux version of tomcat installed by way of registration in windows, how to set it up? O (studying studying) O haha ~

The Internet says to modify catalina.bat and add this line: set JAVA_OPTS= -Xms512m-Xmx512m. I don't think it is desirable, because we did not configure $CATALINA_HOME globally, catalina.bat cannot be executed (it is also impossible to configure $CATALINA_HOME to install multiple tomcat, to specify which one). catalina.bat started the service in real time and stopped as soon as the server logged off the tomcat service.
Open the registry: [HKEY_LOCAL_MACHINE/SOFTWARE/Apache /Apache Software Foundation/Procrun 2.0], you can see all tomcat services with different names that were successfully registered.


Related articles: