问题描述
我在尝试解决Server failed to start for port 8080: Address already in use
"时遇到此错误
I'm getting this error when trying to resolve "Server failed to start for port 8080: Address already in use
"
Error executing script 8888: For input string: ""
有人可以帮忙吗?不知道怎么回事.谢谢.
Can anybody help? Don't know what's wrong. Thanks.
推荐答案
当8080端口已经被使用而你想复用同一个端口时,你应该杀掉它的进程:
When the port number 8080 is already used and you want to reuse the same port , you should kill its process :
首先,检查使用端口 8080 的进程的 pid.为此运行:
First, check the pid of the process that is using port 8080. To do this run:
lsof -w -n -i tcp:8080
在上面的例子中,使用端口 9090 的进程的 pid 是 3812
In the example above, the pid is 3812 for process that is using port 9090
注意PID.您机器上的 PID 可能不同.我们需要这个来执行下一个命令:
Take note of the PID. The PID could be different on your machine. We need this for executing the next command:
所以你必须通过 run-app 来测试它:
so you will have to test it via run-app:
grails run-app
更新:作为 lsof -w -n -i tcp:8080| 的输出awk '{print $2}'|awk 'END{print}'
是 PID, 可以通过PID自动杀死端口进程:
UPDATE :As the output of lsof -w -n -i tcp:8080| awk '{print $2}'|awk 'END{print}'
is the PID, You can kill the port process by PID automatically :
kill -9 `lsof -w -n -i tcp:8080| awk '{print $2}'|awk 'END{print}'`
这篇关于Grails:解决“服务器无法为端口 8080 启动:地址已在使用中".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!