Tomcat cannot successfully start startup.bat solution (crash)

1. First check whether the port is occupied. Generally, the default port of Tomcat is 8080.

You can pass it on the administrator command line

netstat -ano|findstr 8080 command

Check whether there is currently a process occupying the port.

2. If the port is occupied:

Check which program is occupying the port based on the PID (process ID number).

The command is tasklist| findstr   27900

(Note that PID is the number in the last column. Remember to leave spaces when entering the command line , as shown below):

Through the above figure, the programs occupying port 8080 found through PID are javaw.exe and eclipse.

Next, end the process through the command line taskkill /f /t /im cloudmusic.exe (note that there is a space before "/"):

In this way, the java.exe process is terminated.

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

The premise for this problem to occur is that the Tomcat used is an installation-free version. Because when starting tomcat, you need to read environment variables and configuration information. Without this information, you cannot enter the environment variables, causing tomcat to crash.

Solution:
(1): Find startup.bat in the unzipped tomcat bin folder, right-click -> Edit. Configure the following two lines in the file header:
          JAVA_HOME=D:\Java\jdk1.7 (java jdk directory)
         TOMCAT_HOME=D:\tomcat-7.0.40 (decompressed tomcat file directory)

(2). Find shutdown.bat in the unzipped tomcat bin folder, right-click -> Edit. Configure the following two lines in the file header:
        JAVA_HOME=D:\Java\jdk1.7 (java jdk directory)
        TOMCAT_HOME=D:\tomcat-7.0.40 (decompressed tomcat file directory)

3. Server.xml configuration file error.
In the main directory of Tomcat installation, enter the "conf" configuration directory, find the server.xml file, and open it with Notepad.

Find the place where the web path is configured and change it to the path of the web in your project. That's it.

 

After configuring, save it and restart Tomcat.

Guess you like

Origin blog.csdn.net/qq_42003702/article/details/129138690