JBoss 7 installation domain (several servers on the same machine)

Although I have considerable experience in application servers (WebLogic and Apache Tomcat above), this is the first entry I’ll do about it.

JBoss version 7 can say that is impressive (http://www.jboss.org/jbossas) regarding version 6. Everything is much more organized and allows the creation of domains and server groups where deploy / maintain applications centrally.

In this case we will have to install a domain JBoss 7 prepared for high availability and replication session (later configure a balancer to test this).

The official documentation on:


But the truth is that it does not explain too well (or have failed to understand) how to configure a domain.

Before starting some concepts about the processes involved in a domain:

  • Host Controller, this process is responsible for managing the domain (in case of machine domain controller), or connect to the domain controller (other machines). One for machine.
  • Process Controller, responsible for starting and stopping server processes the request of the Host Controller. One for machine.
  • Server: server_name, one process for each of the servers pulled into the machine.

We’ll set up a domain “ha-server-group” will be called with 2 servers on the same machine with names: node1 and node2.


To create this has been used CentOS 6 x32, although the installation can be done on any operating system.

Steps (the IP of the machine is 192 168 128 220):

1- We create environment (user directory, etc …):

[root@clu01 ~]# useradd -m jboss
[root@clu01 ~]# passwd jboss
Changing password for user jboss.
New UNIX password:
BAD PASSWORD: it is too short
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@clu01 ~]# mkdir /vol
[root@clu01 ~]# chown jboss: /vol/ -R
[root@clu01 ~]# su - jboss
[jboss@clu01 ~]$ cd /vol

2- Download the necessary software /vol:

Java JDK 7: http://www.oracle.com/technetwork/java/javase/downloads/jdk7u7-downloads-1836413.html

JBoss 7.1.1.final: http://www.jboss.org/jbossas/downloads

3- Decompress and set environment variables:

[jboss@clu01 vol]$ pwd
[jboss@clu01 vol]$ tar xfz jdk-7u7-linux-i586.tar.gz
[jboss@clu01 vol]$ tar xfz jboss-as-7.1.1.Final.tar.gz

Add to .bash_profile:

export JAVA_HOME=/vol/jdk1.7.0_07

4- We define the domain group, edit the file (for JBOSS_HOME means /vol/jboss-as-7.1.1.Final):


Add the group (end of file):

<server-group name="ha-server-group" profile="ha">
<jvm name="default">
<heap size="64m" max-size="512m"/>
<socket-binding-group ref="ha-sockets"/>

If more groups are eliminated (because that will come pre-configured), we do not need them at all.

5- Define the host as domain controller, by adding servers and interfaces in the group, edit the file:


Host name (first file):

<?xml version='1.0' encoding='UTF-8'?>
<host name="host1-controller" xmlns="urn:jboss:domain:1.2">

Set as domain controller (this is the default configuration but better assure), have to look for local domain controller:

<!-- Alternative remote domain controller configuration with a host and port -->
<!-- <remote host="${jboss.domain.master.address}" port="${jboss.domain.master.port:9999}"/> -->

Define listener interfaces (the IP of the machine if you want to access from outside):

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

Create 2 servers (node1 and node2 inside the group ha-server-group):

<server name="node1" group="ha-server-group" auto-start="true">
<socket-bindings port-offset="100"/>
<server name="node2" group="ha-server-group" auto-start="true">
<socket-bindings port-offset="200"/>

Attention to detail of the port-offset, very helpful to shift all ports on a server using a single parameter setting.

Remove the other servers because they are an example.

6- Creating user/password to access the administration console:

[jboss@clu01 bin]$ pwd


[jboss@clu01 bin]$ ./add-user.sh

What type of user do you wish to add?
a) Management User (mgmt-users.properties)
b) Application User (application-users.properties)
(a): a

Enter the details of the new user to add.
Realm (ManagementRealm) :
Username : admin
Password :
Re-enter Password :
The username ‘admin’ is easy to guess
Are you sure you want to add user ‘admin’ yes/no? yes
About to add user ‘admin’ for realm ‘ManagementRealm’
Is this correct yes/no? yes
Added user ‘admin’ to file ‘/vol/jboss-as-7.1.1.Final/standalone/configuration/mgmt-users.properties’
Added user ‘admin’ to file ‘/vol/jboss-as-7.1.1.Final/domain/configuration/mgmt-users.properties’

7- We start the domain, which will start the 2 servers at once:

[jboss@clu01 bin]$ pwd
[jboss@clu01 bin]$ ./domain.sh

This generates an output where we can see the state startup, if we close the server console closes, will create a startup script if it will be brought into production.

8 – Access the console (with the username and password that we created):

In the console we should now see the two servers.

And we deploy the sample application ClusterWebApp.

We can deploy in the group created the ClusterWebApp.war application (“Add to groups” button), and we can test it, if we agree to:

With this we have finished. In the next post we will create a new node in an additional machine, managed by the same domain controller.

Leave a Reply