Java

Enable Wildfly remote access

This tutotial will show how to enable Wildfly remote access, so you can manage your application server remotely as you would at the local machine it is running on.

The Problem

I believe that everyone is very used to install Wildfly on your local machine running a operation system with GUI and a web browsers available. So, when you need to log on Wildfly’s administrative page at http://localhost:8080/ to manage your application server for, by example, adding users or adding datasources, everything works as expected.
However, if your Wildfly is running on a remote machine and you try to access your administrative page through the network by it’s IP address or hostname, let’s say, at http://54.94.240.170:8080/, you will probably see a graceful This webpage is not available error, in another words, Wildfly said “No, thanks, I’m not allowing requests from another guys than the ones at my local machine”.

The First Possible Solution

We are going to jump right into the quickest solution to enable the remote access, but you can find the explanation of why and how it works at the end of this tutorial.

Before moving on, make sure that the machine where you Wildfly is running is accepting TCP connections on ports 8080 and 9990.

If you Wildfly is running, go to it’s bin folder and execute the following commands to stop it:

cd /opt/wildfly-8.2.0.Final/bin
./jboss-cli.sh --connect --command=:shutdown

Next, start your Wildfly using the command below, which add parameters that enable remote access from any source (IP/hostname) to the administrative page:

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

It’s done!

The Second Possible Solution

As an alternative to adding parameters do your start command, you can edit your standalone.xml to enable remote access from any source. This approach is more useful if you need the remote access enabled most of the time, this way, you don’t need to remember to pass aditional parameters to the start command, as shown above.

First, go to your Wildfly configuration folder:

cd /opt/wildfly-8.2.0.Final/standalone/configuration

Next, edit the standalone.xml file using your preferred file editor and do the changes below:
Replace this:

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

With this:

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

Make sure to save your changes and restart your Wildfly:

/opt/wildfly-8.2.0.Final/bin/jboss-cli.sh --connect --command=:reload

Done.

The Explanation

The short story is, because of security reasons, Wildfly doesn’t want to expose its services on ports that can be accessed without proper authorization. One of those services is the JMX service, which is used for monitoring and managing Java servers trought 9990 port.
By default, the JMX service will allow connections from localhost sources only, as we could see on the standalone.xml file. To change this behavior, you need to allow another hosts to connect to the JMX, by one of the proposed solutions.
On production environments and for security reasons, be aware of exposing this service, you may specify which sources you are willing to allow remote connections instead of exposing your service to anyone, as we did on this tutorial.

Hope it helps. Cya!

bgasparotto

View Comments

Recent Posts

Python function decorator

This guide will show you how to create a Python function decorator with a few…

2 years ago

Got permission denied while trying to connect to the Docker daemon socket

This guide will show you how to fix the error Got permission denied while trying…

2 years ago

Python virtual environment on Intellij IDEA

This guide will show you how to create a Python virtual environment on Intellij IDEA…

2 years ago

Find and kill processes on Linux and Mac by port number

This tutorial will quickly show you how to to find and kill processes on Linux,…

2 years ago

Python: Relocation R_X86_64_PC32 against symbol can not be used when making a shared object Error

This guide shows a possible solution for Python error Relocation R_X86_64_PC32 against symbol can not…

2 years ago

Kubernetes useful commands

I condensed below a cheat sheet of Kubernetes useful commands. I will keep updating this…

2 years ago