The built-in Tomcat in Eclipse under mac reports an error at startup:
Several ports (8080, 8009) required by Tomcat v7.0 Server at localhost are already in use. The server may already be running in another process, or a system process may be using the port. To start this server you will need to stop the other process or change the port number(s).
Solution:
Open a terminal and enter the following command
lsof -i :8080
- 1
- 1
If your occupied port is not 8080, please modify the parameters in the command.
The command outputs the following:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 27132 kaige 41u IPv6 0x9d80e4a27fc1081b 0t0 TCP *:http-alt (LISTEN)
- 1
- 2
- 1
- 2
The process ID that occupies port 8080 on my Mac is 27132, so I will kill this process again
kill -9 27132
- 1
- 1
Please modify the last parameter of this command according to your process ID
Then start Tomcat in Eclipse again, it can start normally!