0

I am in my homework LAN, the private IP of my Macintosh (Mac OS X El Capitan 10.11.4) is 192.168.1.9 and my Firewall is OFF. I have run a wildfly 10 web project on "http://localhost:8080/" until I access to that project from the localhost everything works fine, when I try to reach it from http://192.168.1.9:8080/ google chrome tell me:

This site can’t be reached
192.168.1.9 refused to connect.
Search Google for 192 168 8080
ERR_CONNECTION_REFUSED

I need to access it from an external mobile device but if I can not even access it from my own computer from the IP of the computer itself it's hard to thing to pass to the mobile device...

The strange thing is that I also have MAMP Apache port listening on port 80, and in fact both "http://localhost/" and "http://192.168.1.9/" works perfectly fine (showing me the defaul MAMP "www/index.php").

madx
  • 6,723
  • 4
  • 55
  • 59
  • Does your wildfly server listen on ip 192.168.1.9 port 8080 or just on localhost port 8080. Try a `netstat -ltn` (I hope the syntax is correct, I never used a MAC. ;-) ) – Peter Paul Kiefer May 07 '16 at 13:12
  • I executed the command and I didn't find any "192.168.1.9.8080", does this means something? – madx May 07 '16 at 13:16
  • As I wrote below I solved with `standalone.sh -b 192.168.1.9` but I had to run it from command line... I'm still trying to solve it from eclipse, because it does not still inexplicably work. – madx May 07 '16 at 13:48
  • 1
    Of cause, this means something. As you found out by yourself (congratulations): if a server does not listen on an particular address then, a browser can not connect to this address. And `localhost` is not the same as the network address which is bound to the network adapter. Also, listening to localhost is better than every firewall, because one can not access it from the outer network. localhost is assigned to the so called loopback address which is only available to processes inside of your computer. Please mark your answer as accepted. I will upvote it. – Peter Paul Kiefer May 07 '16 at 14:57
  • 1
    If you changed the ip address within your standalone.xml profile then, it should also work with eclipse. (If you assigned the right standalone.xml to the server adpater profile you are using in eclipse, of cause). If it does not work, even if it is assigned correctly then, perhaps there is an application parameter (-b ...) configured for your run profile. But sorry, I don't know where this can be configured in eclipse. – Peter Paul Kiefer May 07 '16 at 15:14
  • Yes thanks, I just found it on eclipse! I'm adding this to my answer :D – madx May 07 '16 at 16:44

1 Answers1

2

Configure from eclipse

If you want to set the IP from eclipse you should follow these steps (changing the IP in the file standalone.xml doesn't work from eclipse because of the -b option which is set, see more below...)

This are the steps to configure it on eclipse:

  1. Click on your Wildfly Server Wildfly Server
  2. Click on Open Launch Configuration Wildfly Server Configuration Uncheck the Always update arguments related to the runtime and then change your -b option with your_private_ip (if you remove the option, -b localhost you could configure it directly from the standalone.xml file, see the section below for configuring it) Edit Wildfly Server Configuration
  3. Or simply, instead of the 2. solution, check the box Listen on all interfaces to allow remote web connections

Configure from standalone.xml

An alternative is configure in standalone.xml the interfaces section.

Change:

<interfaces>
  <interface name="management">
   <inet-address value="127.0.0.1"/>
  </interface>
  <interface name="public">
   <inet-address value="127.0.0.1"/>
  </interface>
</interfaces>

to:

<interfaces>
  <interface name="management">
   <!-- Use the IPv4 wildcard address -->
   <any-ipv4-address/>
  </interface>
  <interface name="public">
   <!-- Use the IPv4 wildcard address -->
   <any-ipv4-address/>
  </interface>
</interfaces>

Or simply replace 127.0.0.1 with your private IP


Configure from command line (running the server from command line)

Another alternative is running it directly from command line. By default jboss/wildfly binding to localhost, if you want change this, you can execute:

standalone.sh -b 0.0.0.0

listen on all IP addresses of the machine (if multihomed)

or if you want to listen on your ip:

standalone.sh -b your_private_ip

Ref:

madx
  • 6,723
  • 4
  • 55
  • 59
  • In order to help people find your answer, it would be nice if you mark it as the accepted answer. It is a clear, correct and understandable text that could help others on the same problem. – Peter Paul Kiefer May 08 '16 at 08:33
  • Sure but stackoverflow makes you waiting a couple of days, I think that's because stackoverflow would like other people to leave their possible solution. I can't just accept it today. – madx May 08 '16 at 10:42
  • Ok, I did not know! Sorry, next time I'll be more patient. ;-) Perhaps I should ask at least one question by myself to see how it works before I give others good avice. ;-) Thank you! – Peter Paul Kiefer May 08 '16 at 15:59
  • Ahah don't worry, I think that they recently changed this policy inside stackoverflow. Bye and thank you again! – madx May 08 '16 at 16:09