💛 Environment: windows10, centos7.5.1804
linux_debug:Failed to start bean ‘webServerStartStop’; nested exception is org. springframework. boot.
1. Error information
2022-07-08 18:12:25.088 ERROR 33600 --- [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.context.ApplicationContextException: Failed to start bean 'webServerStartStop'; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat server
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:181) ~[spring-context-5.3.21.jar!/:5.3.21]
at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:54) ~[spring-context-5.3.21.jar!/:5.3.21]
at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:356) ~[spring-context-5.3.21.jar!/:5.3.21]
at java.lang.Iterable.forEach(Iterable.java:75) ~[na:1.8.0_333]
at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:155) ~[spring-context-5.3.21.jar!/:5.3.21]
at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123) ~[spring-context-5.3.21.jar!/:5.3.21]
2. Problem description
When running the jar package made by springboot project on Linux;
If the above problem occurs, port 8080 is occupied;
3. Solutions
Close the occupied 8080 port;
3.1 windows
Enter in CMD
# Find the corresponding pid
netstat -ano | findstr 8080
## out:TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 6148
Close the PID number corresponding to the port, assuming that port 8080 corresponds to the process number with process number 123
taskkill /pid 6148 -t -f
3.2 linux
Enter in CMD
# Find the corresponding pid
netstat -ano | grep 8080
## out:TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 6148
Close the PID number corresponding to the port, assuming that port 8080 corresponds to the process number with process number 123
kill -9 PID 123