Test failure of JBoss monitor

Problem

The JBoss Application Server Monitor test button always fails with the message Please check the host and port configuration or returns an exception containing Connection refused to host: 127.0.0.1 with a JBoss Application Server running on a Linux box.

Solution

This is a well-known issue on some Linux distributions. It is necessary to edit the /etc/hosts file.

If the file content looks like 127.0.0.1 myserver.server.com myserver localhost localhost.localdomain, it must be updated using the following sample.

127.0.0.1 localhost localhost.localdomain
myipserver myserver.server.com myserver

The JBoss Application Server must be restarted before trying again.