刚开始入门Springboot运行一些入门案例时遇到的bug
下面是异常信息:
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-10-19 09:22:12.836 ERROR 5368 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Web server failed to start. Port 9090 was already in use.
Action:
Identify and stop the process that's listening on port 9090 or configure this application to listen on another port.
2021-10-19 09:22:12.838 INFO 5368 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor'
异常截图:
异常是因为我使用的端口9090被占用,是一个入门时很容易遇到的异常
Identify and stop the process that’s listening on port 9090 or configure this applicat
正经翻译:确定并停止正在端口9090上侦听的进程,或将此应用程序配置为在另一个端口上侦听。
人话:你9090端口被占用了,你要不杀掉,要不改个端口
解决办法:
- 我给Springboot的端口是9090,那现在我想要让它的端口不是9090,而是9091,或者说另一个项目占用了9090,需要我们把现在的项目改成9091,那么我们就可以在application.properties文件中修改server.port=9091
再运行你看他就变量了
在运行时也改成9091
- 杀掉这个端口
- netstat -ano
win+r打开运行,并输入cmd
输入netstat -ano
然后一回车!就出来巨多端口
然后你找到9090
记住对应的17832
- netstat -ano
输入taskkill /pid 17832 -f 杀掉端口
然后就杀掉了
- netstat -aon|findstr “9090”
直接输入netstat -aon|findstr "9090"并回车
输入taskkill /pid 17832 -f 杀掉端口
然后就杀掉了