I just configured JBoss WildFly. It is running and it is accessible from the same machine, everything is working fine...
My problem is that it is not accessible from another system (I mean in a network, the server (hosted machine) URL can't access from another system).
How can I solve this?
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)
Another 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>
Ref:
- WildFly - Interfaces and ports
- WildFly - Command line parameters
UPDATE
From Wildfly 8 <any-ipv4-address/>
was deprecated and remove in Wildfly 9, then if you are in 9.x or higher use <any-address/>
.
Deprecated. In the absence of -Djava.net.preferIPv4Stack=true
, the
JVM cannot be instructed to bind a socket to all IPv4 addresses, but
only to IPv4 addresses, so the intended semantic cannot be obtained
via this setting alone. Since using any-addressType
and setting
-Djava.net.preferIPv4Stack=true
provides the same effect, this
any-ipv4-addressType
will be removed in a future release.
Eg:
<interface name="global">
<!-- Use the wildcard address -->
<any-address/>
</interface>
The <any-ipv4-address/>
is deprecated in WF 9, use:
...
<interface name="management">
<any-address/>
</interface>
...
(I summary 2 answers for a working solution)
I am using WildFly 10.0.0.Final - lastest version at writing time. Look for file standalone.xml
like this:
On Windows
C:\tools\wildfly-10.0.0.Final\standalone\configuration\standalone.xml
Or Linux, like this:
/home/vyhn.net/wildfly-servlet-10.0.0.Final/standalone/configuration/standalone.xml
edit become to:
<interfaces>
<interface name="management">
<!-- Allow all external IP -->
<any-address/>
</interface>
<interface name="public">
<!-- Allow all external IP -->
<any-address/>
</interface>
</interfaces>
Then go to:
http://your_domain:9990/error/index.html
(port 9990
is default HTTP port, if you use firewall or iptables, remember open port 9990
)
For example:
http://vyhn.net:9990/error/index.html
You will see it works successful.
Lastest reference (WildFly 10): https://docs.jboss.org/author/display/WFLY10/Interfaces+and+ports
Don't forget the firewall!
If you fixed the binding addresses and still can not connect to JBoss, try to work around the server's firewall.
To stop the firewall on Linux RHEL use this command:
/etc/init.d/iptables stop
An update (April 2018):
On RHEL7, where firewalld is used (rather than iptables), you may use:
systemctl stop firewalld
or open the specific Jboss/Wildfly ports (e.g. 8080/9990) with these two commands:
firewall-cmd --zone=public --add-port=8080/tcp --permanent
firewall-cmd --reload
You may use -b 0.0.0.0 to allow access regardless of the public ip assigned, e.g. for computers getting dynamic IP (using DHCP), I find this a convenient way.
Eclipse users: Beware that in Server configuration, the "Host name:" input is used to set the "-b" program argument, overriding your modifications!