java.net.BindException:无法分配请求的地址

我想在我的应用程序中使用低端口(Spring Web上的SNMP陷阱接收器+ Tomcat7)。正如我之前在此线程将低端口绑定到Ubuntu

Server上的Java程序中所告诉的那样,我收到了错误权限被拒绝。然后,我将tomcat7用户组更改为root。但是之后,我得到了java.net.BindException:无法分配请求的地址错误。对于我尝试的每个端口(低端口或高端口),我总是会收到此错误。

我检查端口是否已使用,我看到该端口仍然可用。我检查我的/ etc / host内容,就像这样:

127.0.0.1 localhost 

127.0.1.1 test-server

# The following lines are desirable for IPv6 capable hosts

::1 localhost ip6-localhost ip6-loopback

ff02::1 ip6-allnodes

ff02::2 ip6-allrouters

124.81.xx.x test-server.com

注意:我的操作系统是ubuntu服务器

回答:

您应该绑定到,0.0.0.0而不是尝试指定本地地址。

以上是 java.net.BindException:无法分配请求的地址 的全部内容, 来源链接: utcz.com/qa/397857.html

回到顶部