JBoss AS 7 not accepting remote connections

2019-01-30 03:50发布

问题:

I am using JBoss AS 7 and trying to connect to my application using the IP (from a computer in the intranet). It is not working. If I test from the computer which has the server I can see the system running if I go through localhost (http://localhost:8080/MySystem....) but not If I try with the IP (http://:8080/MySystem....).

Any help?

回答1:

The answer is to edit standalone.xml and insert the tag any-address instead of inet-address bound to 127.0.0.1

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


回答2:

I changed the 127.0.0.1 (localhost) to 0.0.0.0 in standalone.xml. It works. Just be aware of the security.

<interfaces>
    <interface name="management">
        <inet-address value="${jboss.bind.address.management:0.0.0.0}"/>
    </interface>
    <interface name="public">
        <inet-address value="${jboss.bind.address:0.0.0.0}"/>
    </interface>
    <!-- TODO - only show this if the jacorb subsystem is added  -->
    <interface name="unsecure">
        <!--
          ~  Used for IIOP sockets in the standard configuration.
          ~                  To secure JacORB you need to setup SSL 
          -->
        <inet-address value="${jboss.bind.address.unsecure:0.0.0.0}"/>
    </interface>
</interfaces>


回答3:

Did you configure the IP address into the config file?

Starting jboss without configuring the ip address will set the default address for jboss to localhost which is fit for development or maybe for a production server, where apache is used as the proxy to jboss and resides in the same machine.

To set the ip address for JBoss :

To a specific IP address
run.sh -b 10.62.31.31
To localhost or the IP address assigned to the server
run.sh -b 0.0.0.0

You can also change it in the configuration file under the <interfaces> section.



回答4:

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: On RHEL7, where iptables is not installed - you may use:

systemctl stop firewalld