Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot assign requested address in AWS #493

Closed
DaniAkash opened this issue Nov 3, 2017 · 9 comments
Closed

Cannot assign requested address in AWS #493

DaniAkash opened this issue Nov 3, 2017 · 9 comments

Comments

@DaniAkash
Copy link

I have implemented a websocket server using Spring framework and Netty SocketIO. While development I used the host address as localhost and the server was working perfectly fine.

When I'm trying to deploy my code to AWS, I changed the host address to my instance's public IP address. But I'm getting the following error and I'm unable to start my server

Caused by: java.net.BindException: Can't assign requested address
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 io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketChannel.java:125)
at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:484)
at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1080)
at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:430)
at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:415)
at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:903)
at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:197)
at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:350)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:380)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116)
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137)
@DaniAkash
Copy link
Author

Should I be using any other IP address instead of the public IP address of my Instance?

@sunilgulabani
Copy link

@DaniAkash Am facing same issue. Did you found any solution?

@lilaizhencn
Copy link

ifconfig find intranet ip, use it

@pablojr
Copy link

pablojr commented Jan 24, 2018

@DaniAkash @sunilgulabani if you ever solved this issue in AWS with suggestion from @lilaizhencn please don't forget to update this ticket so we can document a "AWS How-to" later. Thanks.

@sunilgulabani
Copy link

@pablojr I was able to resolve this issue. When we create SocketIO Server with hostname as "localhost", application is only accessible from local environment. I changed the hostname parameter value to "0.0.0.0" and it worked seamlessly. Rest AWS security group need to be expose for port which we used.

@DaniAkash
Copy link
Author

@sunilgulabani it works! thank you!!

@anilpawar1
Copy link

anilpawar1 commented Dec 10, 2019

tried with -Dserver.port=0.0.0.0
thanks bro..

@hbtechnologia
Copy link

@pablojr I was able to resolve this issue. When we create SocketIO Server with hostname as "localhost", application is only accessible from local environment. I changed the hostname parameter value to "0.0.0.0" and it worked seamlessly. Rest AWS security group need to be expose for port which we used.

can you please tell me how to do that i am facing same issue but do not know how to do that. ??Your help wil be appreciated with bundle of thanks.
ss

@hbtechnologia
Copy link

@sunilgulabani it works! thank you!!

can you please tell me how to do that i am facing same issue but do not know how to do that. ??Your quick help will be highly appreciated...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants