Windows 原因:java.net.BindException:地址已在使用中:bind
我试图通过点击RunAs->spring boot App来运行spring boot应用程序。我得到的错误如下: 原因:java.net.BindException:地址已在使用中:bind 当我使用netstat命令时,我看到以下没有进程ID的情况: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 注意-
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.
}