JBoss WildFly: Starts but can't connect?

老子叫甜甜 提交于 2019-11-27 11:40:33

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:

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!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!