0

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

  1. virtual IP Address-1.1.1.1
  2. 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?

ram
  • 23
  • 6
  • Do you mean you can use private IP address in Azure VM to access it? – Jason Ye Aug 04 '17 at 08:38
  • I want to mention here that for example my local IP is 172.11.24.10 and public ip is 41.78.216.35. and when I pass the -wh 41.78.216.35 then I get the exception and If run this without any parameter then it runs on local ip (172.11.24.10). but we can not access that ip on publicly because it is a private ip. – ram Aug 04 '17 at 08:38
  • @JasonYe-MSFT I am able to use private IP but I want to use public IP. it is running on private ip. – ram Aug 04 '17 at 08:40
  • By default, we should use 172.11.24.10. you can't access this public IP address, can you telnet this public IP address and that port? – Jason Ye Aug 04 '17 at 08:41
  • Have you add port to Azure NSG inbound rules? – Jason Ye Aug 04 '17 at 08:42
  • Java doesn't recgonise `-wh` so I am assume this is the custom parameter you specified in your APP? Also, I guess your trying to bind to `0.0.0.0` which is all the network interface of the local machine? – Minh Kieu Aug 04 '17 at 08:43
  • Please run this command `netstat -ant | grep 22` to find ssh bind to which IP. – Jason Ye Aug 04 '17 at 08:46
  • @JasonYe-MSFT I just want to host leshan on web server and my client can communicate them. yes I have done the telnet but it is not pinging but still my angular2 web app is running on the same server and i am able to access via public ip. – ram Aug 04 '17 at 08:49
  • @MinhKieu yes you are right but i have changed the code and extended the parameters for web host. – ram Aug 04 '17 at 08:50
  • @JasonYe-MSFT it is bind on private ip (172.11.24.10) and 0.0.0.0. – ram Aug 04 '17 at 08:51
  • @ram can you access your java from Azure VM? listen on which port? – Jason Ye Aug 04 '17 at 08:55
  • The post here may help - https://stackoverflow.com/questions/8965155/cannot-assign-requested-address-jvm-bind – Minh Kieu Aug 04 '17 at 08:58
  • @JasonYe-MSFT yes I am able to run simple java application on azure vm. I just want to let you know that on same VM I have hosted the node app and for that I have specified the public IP of vm and it is working but when I do the same for java then it throws the exceptions – ram Aug 04 '17 at 09:00
  • @ram could you please tell me which port use for this java application? – Jason Ye Aug 04 '17 at 09:04
  • @JasonYe-MSFT 8080 for web app and 5684 for coap. and both are enable. – ram Aug 04 '17 at 09:11

0 Answers0