【问题标题】:JBoss WildFly: Starts but can't connect?JBoss WildFly:启动但无法连接?
【发布时间】:2015-01-10 12:09:15
【问题描述】:

我刚刚配置了 JBoss WildFly。它正在运行,并且可以从同一台机器访问,一切正常......

我的问题是它无法从另一个系统访问(我的意思是在网络中,服务器(托管机器)URL 无法从另一个系统访问)。

我该如何解决这个问题?

【问题讨论】:

    标签: jboss wildfly wildfly-8


    【解决方案1】:

    别忘了防火墙!

    如果您修复了绑定地址,但仍然无法连接到 JBoss,请尝试绕过服务器的防火墙。

    要在 Linux RHEL 上停止防火墙,请使用以下命令:

    /etc/init.d/iptables stop
    

    更新(2018 年 4 月):

    RHEL7 上,使用 firewalld(而不是 iptables),您可以使用:

    systemctl stop firewalld
    

    或使用以下两个命令打开特定的 Jboss/Wildfly 端口(例如 8080/9990):

    firewall-cmd --zone=public --add-port=8080/tcp --permanent
    firewall-cmd --reload
    

    【讨论】:

      【解决方案2】:

      您可以使用 -b 0.0.0.0 来允许访问,而不管分配的公共 IP,例如对于获取动态 IP(使用 DHCP)的计算机,我发现这是一种方便的方法。

      Eclipse 用户:请注意,在服务器配置中,“主机名:”输入用于设置“-b”程序参数,覆盖您的修改!

      【讨论】:

        【解决方案3】:

        默认jboss/wildfly绑定到localhost,如果你想改变这个,你可以执行:

        standalone.sh -b 0.0.0.0
        

        监听机器的所有 IP 地址(如果多宿主)

        另一种选择是在standalone.xml 接口部分进行配置。

        变化:

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

        到:

        <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>
        

        参考:

        更新

        从 Wildfly 8 &lt;any-ipv4-address/&gt;deprecated 并在 Wildfly 9 中删除,然后如果您使用的是 9.x 或更高版本,请使用 &lt;any-address/&gt;

        已弃用。在没有-Djava.net.preferIPv4Stack=true 的情况下, 无法指示 JVM 将套接字绑定到所有 IPv4 地址,但是 仅适用于 IPv4 地址,因此无法获得预期的语义 仅通过此设置。由于使用any-addressType 并设置 -Djava.net.preferIPv4Stack=true 提供相同的效果,这个 any-ipv4-addressType 将在未来的版本中删除。

        例如:

        <interface name="global">
           <!-- Use the wildcard address -->
           <any-address/>
        </interface>
        

        【讨论】:

        • 谢谢!对于 Wildfly 9.0.1 中的standalone.xml,它的:
        • 这对 Wildfly 9.0.2+ 不再有效。请参阅下面@bkomac 的答案
        • 很棒的更新,any-address 正是我所需要的。
        【解决方案4】:

        (我总结了 2 个可行解决方案的答案) 我正在使用 WildFly 10.0.0.Final - 写作时的最新版本。像这样查找文件standalone.xml

        在 Windows 上

        C:\tools\wildfly-10.0.0.Final\standalone\configuration\standalone.xml
        

        或者Linux,像这样:

        /home/vyhn.net/wildfly-servlet-10.0.0.Final/standalone/configuration/standalone.xml
        

        编辑成:

        <interfaces>
            <interface name="management">
                <!-- Allow all external IP -->
                <any-address/>
            </interface>
            <interface name="public">
                <!-- Allow all external IP -->
            <any-address/>
            </interface>
        </interfaces>
        

        然后转到:

        http://your_domain:9990/error/index.html
        

        (端口9990是默认的HTTP端口,如果你使用防火墙或iptables,记得打开端口9990) 例如:

        http://vyhn.net:9990/error/index.html
        

        你会看到它成功了。
        最新参考(WildFly 10):https://docs.jboss.org/author/display/WFLY10/Interfaces+and+ports

        【讨论】:

          【解决方案5】:

          &lt;any-ipv4-address/&gt; 在 WF 9 中已弃用,请使用:

           ...   
              <interface name="management">
                 <any-address/>
              </interface>
           ...
          

          【讨论】:

          • 从 9.0.2 开始,'' 会在启动wildfly时产生错误... :-o
          猜你喜欢
          • 2015-03-19
          • 2021-04-14
          • 2018-06-30
          • 2021-01-10
          • 1970-01-01
          • 1970-01-01
          • 2016-04-29
          • 2022-11-09
          • 2013-02-23
          相关资源
          最近更新 更多