Loading...

Enable remote access for JBoss Web

:heavy_exclamation_mark: This post is older than a year. Consider some information might not be accurate anymore. :heavy_exclamation_mark:

This post demonstrates how to enable the remote access for JBoss in standalone mode. It includes several CLI commands to check the status at runtime. To apply the changes a restart is needed.

List all interfaces

[standalone@localhost:9999 /] :read-children-names(child-type=interface)
{
    "outcome" => "success",
    "result" => [
        "management",
        "public",
        "unsecure"
    ]
}

The public interface is reponsible for the remote access. Below the output of the default configuration.

[standalone@localhost:9999 /] /interface=public:read-resource(include-runtime=true)
# or alternatively
[standalone@localhost:9999 /] cd interface=public
[standalone@localhost:9999 interface=public] :read-resource(include-runtime=true)
{
    "outcome" => "success",
    "result" => {
        "any" => undefined,
        "any-address" => undefined,
        "any-ipv4-address" => undefined,
        "any-ipv6-address" => undefined,
        "inet-address" => expression "${jboss.bind.address:127.0.0.1}",
        "link-local-address" => undefined,
        "loopback" => undefined,
        "loopback-address" => undefined,
        "multicast" => undefined,
        "name" => "public",
        "nic" => undefined,
        "nic-match" => undefined,
        "not" => undefined,
        "point-to-point" => undefined,
        "public-address" => undefined,
        "resolved-address" => "127.0.0.1",
        "site-local-address" => undefined,
        "subnet-match" => undefined,
        "up" => undefined,
        "virtual" => undefined
    }
}

If you want to allow the access from any address (IPv4 and IPv6), you need to change the standalone.xml.

<interface name="public">
            <!-- <inet-address value="${jboss.bind.address:127.0.0.1}"/> -->
            <any-address/>
</interface>

If you want to do it via CLI (will produce above result in the standalone.xml).

[standalone@localhost:9999 interface=public] /interface=public:remove()
{"outcome" => "success"}
[standalone@localhost:9999 interface=public] /interface=public:add(any-address=true)
{"outcome" => "success"}
# restart required
[standalone@localhost:9999 interface=public] shutdown --restart=true

Since it is an default expression you may also start JBoss with following arguments

./standalone.sh -b 0.0.0.0 -bmanagement 0.0.0.0 &

If you want to bind it to a specific inet-address

/interface=interfacename/:add(inet-address=192.168.0.2)
# change it
/interface=interfacename/:write(inet-address=192.168.100.2)

See also RedHat JBoss Network and Port Configuration

Please remember the terms for blog comments.