在linux/mac环境中,用非root用户,将某个小于1024的端口绑定到socket上时,系统抛出java.net.BindException: Permission denied异常信息。
查了下资料,大概有如下两种解决方案:
1、将用户转换为root用户;
2、将端口号修改为大于或等于1024。错误信息如下:
Exception in thread "Thread-0" java.lang.RuntimeException: java.net.BindException: Permission denied (Bind failed) at com.icegreen.greenmail.server.AbstractServer.run(AbstractServer.java:87) Caused by: java.net.BindException: Permission denied (Bind failed) at java.net.PlainSocketImpl.socketBind(Native Method) at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:387) at java.net.ServerSocket.bind(ServerSocket.java:375) at java.net.ServerSocket.<init>(ServerSocket.java:237) at com.icegreen.greenmail.server.AbstractServer.openServerSocket(AbstractServer.java:59) at com.icegreen.greenmail.server.AbstractServer.run(AbstractServer.java:81)
Socket 绑定异常 解决方案
最新推荐文章于 2021-03-31 16:23:22 发布