java.net.BindException: Cannot assign requested address: bind 求大神解答

m0_38095532 2020-10-17 05:20:49
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
Caused by: com.sun.xml.internal.ws.server.ServerRtException: 服务器运行时错误: java.net.BindException: Cannot assign requested address: bind
at com.sun.xml.internal.ws.transport.http.server.ServerMgr.createContext(ServerMgr.java:117)
at com.sun.xml.internal.ws.transport.http.server.HttpEndpoint.publish(HttpEndpoint.java:64)
at com.sun.xml.internal.ws.transport.http.server.EndpointImpl.publish(EndpointImpl.java:232)
at com.sun.xml.internal.ws.spi.ProviderImpl.createAndPublishEndpoint(ProviderImpl.java:126)
at javax.xml.ws.Endpoint.publish(Endpoint.java:240)
at com.example.canyun.CanyunApplication.main(CanyunApplication.java:30)
... 8 more
Caused by: java.net.BindException: Cannot assign requested address: bind
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at sun.net.httpserver.ServerImpl.<init>(ServerImpl.java:100)
at sun.net.httpserver.HttpServerImpl.<init>(HttpServerImpl.java:50)
at sun.net.httpserver.DefaultHttpServerProvider.createHttpServer(DefaultHttpServerProvider.java:35)
at com.sun.net.httpserver.HttpServer.create(HttpServer.java:130)
at com.sun.xml.internal.ws.transport.http.server.ServerMgr.createContext(ServerMgr.java:86)
... 13 more



本地可执行,修改IP+端口上传到服务器就报这个 有没有大神可以解答一下呢?
...全文
5885 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
m0_38095532 2020-10-19
  • 打赏
  • 举报
回复
引用 3 楼 tianfang 的回复:
需要绑定在内网Ip上,可能需要设定内外网端口映射 你运行 ifconfig 或 ip addr 看看本机ip地址
已经处理了,直接用 0.0.0.0:8888就可以了,而且还不用做映射
tianfang 2020-10-19
  • 打赏
  • 举报
回复
需要绑定在内网Ip上,可能需要设定内外网端口映射 你运行 ifconfig 或 ip addr 看看本机ip地址
m0_38095532 2020-10-19
  • 打赏
  • 举报
回复
引用 1 楼 tianfang 的回复:
地址 端口不对,最大可能是端口冲突,你用了什么IP和端口
用的是阿里云服务器外网IP地址 端口查看了是没有冲突的。
tianfang 2020-10-17
  • 打赏
  • 举报
回复
地址 端口不对,最大可能是端口冲突,你用了什么IP和端口

62,634

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧