启动Jetty的时候,发现报错
Failure: Address already in use: bind
,简单来说,就是端口占用了,我们需要查看是哪个玩意在占用端口,一般情况下是javaw.exe,可以直接执行taskkill /f /t /im javaw.exe
或taskkill /f /t /im java.exe
就可以杀死进程,释放端口了,如果上一个方法还不奏效,需要查看具体是那一个占用了
出现的错误
当发现出现端口占用的情况的时候,先看看自己的eclipse控制台,看看是不是重复启动了,如果不是,就需要查找端口,关闭8080端口占用的程序
[ERROR] Failed to execute goal org.eclipse.jetty:jetty-maven-plugin:9.4.6.v20170531:run (default-cli) on project demo: Failure: Address already in use: bind -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
解决办法
1、netstat -ano,列出所有端口的情况
2、查看被占用端口对应的程序,我查的是8080端口,那个pid是哪个程序占用了,tasklist|findstr “24072”
3、关闭这个程序,我们看到了,这个占用的程序是 javaw.exe,需要关闭他taskkill /f /t /im javaw.exe
4、再次启动服务器
端口绑定成功