TOMCAT-unable to start successfully-double-click startup.bat to crash the solution

Tomcat can not start successfully-double-click startup.bat to crash the solution
——————————————
[Reprinted] Original link: https://blog.csdn.net/scau_lth/article /details/83218335

This is a mistake that novices often make, as long as you pay attention to three points, you can solve this problem.

1. First, check whether the port is occupied. Generally, the default port of Tomcat is 8080. You can use the command "netstat -ano|findstr "8080"" on the administrator command line to check whether any process currently occupies the port.
1. If the port is occupied:
Insert picture description here

According to the PID (process id number) to check which program this occupies the port, the command is "tasklist|findstr "27900"" (note that PID is the number in the last column, remember that the space should be a space when entering the command line, As shown below):

Insert picture description here

As shown in the figure above, the program that occupies port 8080 is found through PID as java.exe, and the process is terminated by the command line "taskkill /f /t /im java.exe" below (note that there is a space before "/"):
Insert picture description here

At this point, the java.exe process is ended.

2. If the port is not occupied, it may be the problem caused by the second point

2. The premise for this situation is that the Tomcat used is an installation-free version. Because the environment variables and configuration information need to be read when starting tomcat, the environment variables cannot be registered without this information, which leads to a crash of tomcat.
Solution:
1: Find startup.bat in the bin folder of the decompressed tomcat, right-click -> edit. Add the following two lines in the file header:
SET JAVA_HOME=D:\Java\jdk1.7 (java jdk directory)
SET TOMCAT_HOME=E:\tomcat-7.0 (decompressed tomcat file directory)

2. Find shutdown.bat in the bin folder of the decompressed tomcat, right-click -> edit. Add the following two lines in the file header:
SET JAVA_HOME=D:\Java\jdk1.7 (java jdk directory)
SET TOMCAT_HOME=E:\tomcat-7.0 (decompressed tomcat file directory)

Third, the server.xml configuration file error
This is the most common mistake made by novices, and the least easy to be discovered. The following content will hit the blackboard and draw the key points!

In the main directory of the Tomcat installation, enter the "conf" configuration directory, find the server.xml file, and open it with Notepad.
Insert picture description here

Find the place where the web path is configured and change it to the actual path of the web in your project.
Insert picture description here

Save after configuration, and then restart Tomcat.

Guess you like

Origin blog.csdn.net/qq_27946017/article/details/114258943