springboot集成Netty-SocketIO ,启动异常Cannot assign requested address: bind

导读:本篇文章讲解 springboot集成Netty-SocketIO ,启动异常Cannot assign requested address: bind,希望对大家有帮助,欢迎收藏,转发!站点地址:www.bmabk.com

项目场景:

项目集成Netty-SocketIO,启动项目报错Cannot assign requested address: bind


错误代码:

 SocketIO server start failed at port: 8092!

java.lang.IllegalStateException: Failed to execute CommandLineRunner
	at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:798) [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
	at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:779) [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:322) [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237) [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
	at net.newcapec.cloud.MessageCenterApplication.main(MessageApplication.java:31) [classes/:na]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_291]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_291]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_291]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_291]
	at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-2.3.0.RELEASE.jar:2.3.0.RELEASE]
Caused by: java.net.BindException: Cannot assign requested address: bind
	at sun.nio.ch.Net.bind0(Native Method) ~[na:1.8.0_291]
	at sun.nio.ch.Net.bind(Net.java:438) ~[na:1.8.0_291]
	at sun.nio.ch.Net.bind(Net.java:430) ~[na:1.8.0_291]


 

原因分析:

bind的问题,一般都是配置出现问题。

仔细查看配置相关文件,确保host正确,去报端口不存在占用等情况。


解决方案:

从配置着手,仔细检查。

一、本地开发环境下,socketIo的host参数配置为127.0.0.1即可,

二、服务器部署运行时,socketIo的host参数配置为服务器的内网ip,或者0.0.0.0

三、检查SocketIO端口是否被占用

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/114735.html

(0)
Java光头强的头像Java光头强

相关推荐

发表回复

登录后才能评论
极客之音——专业性很强的中文编程技术网站,欢迎收藏到浏览器,订阅我们!