Configure multiple Tomcats on one computer

There are too many projects that need to be used recently. The two existing tomcat servers are not enough. I need to install another one. One of the existing servers on my computer is the green version of tomcat 6.0, which is mainly used for "embedding into MyEclipse to cooperate with "Development", one is to install version 7.0 to release some projects that need to be used recently. According to my situation here, and then post another one, there are 3 methods:

1. Install a Tomcat6.0, because I already have a green version locally, and it can be regarded as not installed.

2. Publish a compressed version of tomcat6.0, two parallel, without affecting each other

3. Publish a compressed version of Tomcat7.0, which will not affect the 6.0 and installed version 7.0.

I use the second: release a compressed version of 6.0 , the following are the steps.

 

1. Download the compressed package : the next green version of 6.0 from the official website, the address is as follows: http://tomcat.apache.org/download-60.cgi , unzip, I unzip it locally: D:\Program Files\Apache Software Foundation\apache-tomcat-6.0.53

 

Precautions:

a. It is advisable to download the compressed package of the corresponding number of digits according to the number of digits of your computer

b. Some articles on the Internet say "make a copy of the original Tomcat6.0 directory when publishing", which is a bit incomplete: if the original is the green version, it is feasible, but if the installed version is not feasible. A compressed version of Tomcat must be used . How to see whether it is the installed version or the green version? Usually the files in the bin directory of the installed version lack some commonly used bat files (of course not necessarily, this is just a simple way to distinguish) , like my original Tomcat6.0 bin directory, there are only 4 files: tomcat6.exe, tomcat6w.exe, bootstrap.jar, tomcat-juli.jar, such as mine, are obviously installed versions and must not be used. I didn't know what an installed version was and what a compressed version was before, and then I hit a wall several times. Only then did I understand this.

 

2. Configure the CATALINA_HOME environment variable : the configuration method is the same as the configuration of the JAVA_HOME environment variable, Computer---->Right-click Properties--->Advanced System Settings--->Advanced--->Environment Variables--->New System Variables, The variable name is CATALINA_HOME2, and the variable value is the directory of Tomcat after decompression. Here I am the directory in the first step.

Notes (from the Internet):

a. The path cannot end with a semicolon , such as D:\Program Files\Apache Software Foundation\apache-tomcat-6.0.53;

In this way, an error will appear indicating that CATALINA_HOME is not configured

b. The path cannot end with \ , such as D:\Program Files\Apache Software Foundation\apache-tomcat-6.0.53\, an error of java.util.logging.ErrorManager will appear, and the screen will flash by.

c. The punctuation of the path cannot be written too much or too little. It is best to open the Tomcat directory and copy it directly from the address bar

 

3. Modify the bat file : modify catalina.bat and startup.bat in the bin directory, and change CATALINA_HOME to CATALINA_HOME2 . (PS: In order to ensure that there are no other errors - like shutdown.bat - I replaced CATALINA_HOME in all bat files in the bin directory with CATALINA_HOME2)

 

4. Modify the port number : modify the confi/server.xml, look for the port keyword, there are mainly the following three places:

a、<Server port="8006" shutdown="SHUTDOWN">

b、<Connector port="8000" protocol="HTTP/1.1"

c、<Connector port="8007" protocol="AJP/1.3" redirectPort="8443" />

Change each port number to one that has not been occupied. The above is the port I modified.

 

5. Use startup.bat to start Tomcat : Double-click startup.bat in the bin directory . If everything is configured normally, the well-known Tomcat startup log will appear. In this case, the solution is as follows:

a. Run cmd to open the console, enter the Tomat directory/bin folder, and enter the following command to run: startup.bat

b. The console displays the following error: The CATALINA_HOME2 environment variable is not defined correctly
This environment variable is needed to run this program

c. This is obviously a problem with my CATALINA_HOME2 configuration. After the modification is correct, close the current console, reopen one and repeat the above command , and Tomcat starts successfully.

Note: After modifying CATALINA_HOME2, you must restart the cmd console, otherwise it will have no effect

 

6. Use tomcat6.exe to start Tomcat : Double-click tomcat6.exe in the bin directory, the usual situation is a flash , and no error is reported tomcat will not start. It is because this decompressed version does not register the service in Windows and can only start Tomcat through startup.bat. If you want to run Tomcat through tomcat6.exe, you can only manually register the service . Proceed as follows:

a. Run cmd to open the console, enter the Tomat directory/bin folder, and enter the following command to run: service.bat install

b. Program prompt: The service 'Tomcat6' has been installed . The service Tomcat has been successfully installed.

c. Check Apache Tomcat 6.0 Tomcat6 in the service, this is the service just registered. After that, you can run Tomcat by "double-clicking tomcat6.exe under bin".

 

At this point, the entire publishing process is complete.

 Good luck everyone!

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326418992&siteId=291194637