After modifying the tomcat port, start tomcat in eclispe, it is still the original port!

Today, I want to change a port for tomcat. After I change the port of tomcat, I start tomcat in eclispe and find that it is still the original port. That is to say, if the port of tomcat is modified, the newly modified port number does not work!

My operation is as follows:

1. Open the installation directory of tomcat, the server.xml file under G:\apache-tomcat-7.0.53-windows-x64\apache-tomcat-7.0.53\conf


At the beginning of tomcat, the default port was 8080, now I want to change the port to 8089, and then save the server.xml file


Then start tomcat in eclispe, as shown in the figure below, the port number is still the original 8080, indicating that the port in the server.xml file we just modified in the tomcat directory does not work. How to do it? Don't worry!


You can see from the picture below. In fact, if you develop a project in eclispe, eclispe will generate a Servers directory for us by default. You can see that the file name in this directory is the same as the configuration file name in tomcat.



As shown below: Double-click to open the server.xml file, change the port number to 8089, restart tomcat in eclispe, we can see that the port displayed on the console is 8089, which means that the port number was modified successfully!

As shown in the figure below, now access the project through the browser, and the access is successful!

Of course, you can also change the port number on the eclispe interface, as shown below


After changing, restart tomcat in eclispe!

Finally, let's summarize, we can understand it like this, eclispe is bound to tomcat, if we are in the local server under G:\apache-tomcat-7.0.53-windows-x64\apache-tomcat-7.0.53\conf. Modify the port number in the xml file. In fact, when starting tomcat in eclispe, the original port number is still used, and the new port number will not be used. If the port number is modified in the server.xml file in the Servers directory of eclispe, the When you start tomcat in eclispe, you can use the new port number! My personal bold guess is that the configuration files such as server.xml, tomcat-users.xml and web.xml in the Servers directory of eclispe are actually copied from our local tomcat installation directory to In eclipse, if we modify the configuration file in the Servers directory of eclispe , it is equivalent to modifying the configuration file in our local tomcat installation directory at the same time, but conversely, if we modify the configuration file in our local tomcat directory, it will not be. At the same time, we modify the configuration file in the Servers directory of eclispe ! I don't know if everyone agrees with my guess.


Reprinted from: https://blog.csdn.net/czh500/article/details/77923136

Guess you like

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