I want to run my java application (i.e. Leshan Server) run Azure Linux VM. My VM is configured as dynamic IP. It is showing two IP addresses.
These are
- virtual IP Address-1.1.1.1
- 0.0.0.0 (private IP)
these IP addresses are for example only.
My java application is using jetty server inside the code and I am passing the public from command window like this
java -jar leshan-server-demo-1.0.0-SNAPSHOT-jar-with-dependencies.jar -wh 0.0.0.0
.
but it is throwing the exception
java.net.BindException: Cannot assign requested address
at sun.nio.ch.Net.bind0(Native Method) ~[?:1.8.0_141]
at sun.nio.ch.Net.bind(Net.java:433) ~[?:1.8.0_141]
at sun.nio.ch.Net.bind(Net.java:425) ~[?:1.8.0_141].
NOTE- It is running perfectly on local (private IP) and port is also open and not in use.
Is there other way to connect socket connection on azure or aws vms public IPs?
Copyright License:
Author:「ram」,Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.
Link to:https://stackoverflow.com/questions/45501926/why-i-am-not-able-to-host-java-application-on-azure-linux-vm-virtual-ip