Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows 原因:java.net.BindException:地址已在使用中:bind_Windows_Spring Boot_Process_Taskkill - Fatal编程技术网

Windows 原因:java.net.BindException:地址已在使用中:bind

Windows 原因:java.net.BindException:地址已在使用中:bind,windows,spring-boot,process,taskkill,Windows,Spring Boot,Process,Taskkill,我试图通过点击RunAs->spring boot App来运行spring boot应用程序。我得到的错误如下: 原因:java.net.BindException:地址已在使用中:bind 当我使用netstat命令时,我看到以下没有进程ID的情况: netstat -na | find "8080" TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING TCP [::]:8080 [::]:0 LISTENING 注意-

我试图通过点击RunAs->spring boot App来运行spring boot应用程序。我得到的错误如下:

原因:java.net.BindException:地址已在使用中:bind

当我使用netstat命令时,我看到以下没有进程ID的情况:

netstat -na | find "8080"

TCP    0.0.0.0:8080   0.0.0.0:0    LISTENING

TCP    [::]:8080      [::]:0       LISTENING
注意-我正在windows计算机上运行代码


如何终止这些进程?

尝试lsof-I命令,它应该列出pid之间的网络连接。
或者更好的lsof-i:8080

您可以通过在
应用程序.properties
中提供类似
服务器.port=4567
的内容来更改应用程序的端口号

您可以按照中提到的步骤终止在端口号上运行的进程:-


很可能正在使用“8080”,您可以结束任务/关闭应用程序,或者只需更改Spring boot使用的默认端口。可以通过多种方式实现,application.properties就是其中之一

您好,我忘了提到我正在Windows计算机上运行此代码。因此,我无法运行上面的命令lsof-iOn windows machine添加
o
标志以获取进程ID(如
netstat-nao | find“8080”
),然后您可以使用
Taskkill
try {
            SpringApplication.run(Application.class, args);
        } catch     (org.springframework.boot.web.server.PortInUseException e) {
//Runtime.exec("pkil")..
//or
SpringApplication.run(Application.class, otherargs);
//SpringApplication.run(Application.class, new String[]{"--server.port=8444"});
//when invoked recursively it is a port rebalancer for port usage among port pool with server as from client for startup stage via application restarts within many busy ports which are used before or without querying.

}