IDEA starts the service and prompts that the port is occupied, and the Web server failed to start.Port was already in use.

This is usually caused by the port being occupied by another program. You can try the following to solve this problem

linux system

1. Kill the process that occupies the port. You can use the command sudo lsof -i :<port number> in the terminal to find the process occupying the port, and use the kill command to kill the process. For example, if the port number is 8080, you can use the following command:

sudo lsof -i :8080
kill <进程号>

2. Modify the port number for IDEA to start the service. You can open the IDEA settings interface, then find "Build, Execution, Deployment" -> "Debugger" -> "Built-in server", and change the default port number to an unoccupied port number.

Check firewall settings. You should make sure that the firewall is not preventing IDEA from starting the service. You can try temporarily disabling the firewall and restarting the service.

windows system

1. Kill the process that occupies the port. Likewise, on Windows, you can also use terminal commands to find the process and kill it. First open a command prompt and enter the command:

netstat -ano | findstr :<端口号>

This command will list details of all processes occupying the port, including the process ID. Then you can use the following command to kill the process occupying the port:

taskkill /pid <进程ID> /f

Among them, /fthe function is to forcibly end the process.

2. Modify the port number for IDEA to start the service. Similarly, you can open the IDEA settings interface and change the port number to other unoccupied port numbers in "Build, Execution, Deployment" -> "Debugger" -> "Built-in server".

3. Check the firewall settings. If you use a firewall in the Windows system, it may prevent IDEA from starting the service. You can try to temporarily disable the firewall, because sometimes the firewall may prevent IDEA from starting the service.

write at the end

If you are interested in related articles, you can pay attention to the official account "Architecture Palace", and will continue to update AIGC, java basic interview questions, netty, spring boot, spring cloud and other series of articles, and a series of dry goods will be delivered at any time!

Guess you like

Origin blog.csdn.net/jinxinxin1314/article/details/131026500