Heiko Braun Software Engineer

Running a domain on a single machine

Sometimes it’s required to verify a domain setup with multiple hosts involved. But what if only a single machine is at your service? In this post, I am going to walk you through a simple setup that allows you to create a JBossAS 7 domain on a number of virtual hosts: Simply by binding the slave controllers to virtual network interfaces.

Create a slave controller configuration 

Create a copy of the domain directory that ships with the default distribution.

cp -R domain domain2

The slave controller configuration (domain2/configuration/host.xml) requires two significant changes:

1.) assign a distinct host name
2.) turn the host control into a slave

The first step requires you to chose a name that distinct across the domain. We are going to name it “slave.local”:

[code] <host name=”slave.local” xmlns=”urn:jboss:domain:1.3″>

The second step is as simple. Instead of declaring another master controller (element) we point the slave controller to a master it should connect to:

[code] <remote host=”${jboss.domain.master.address}” port=”${jboss.domain.master.port:9999}” security-realm=”ManagementRealm”/>

For our purposes we stick with the expressions (${foo.bar}), because it allows us to easily pass in arguments from the command line. But you could as well provide fixed values.

Starting the host controller and it slave

Bring up the domain by starting the domain controller:


Notice that we launch it without arguments. In this case it will refer to the default domain directory.

After a few seconds the host controller should up and running and started it’s default servers:

[Host Controller] 12:55:32,157 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015874: JBoss AS 7.1.2.Final-SNAPSHOT “Brontes” (Host Controller) started in 5194ms – Started 12 of 12 services (0 services are passive or on-demand)

The virtual network interface

Before we can launch the second controller (slave) we need to create a virtual network interface (alias) for the second process to bind to. We’ll simply create an alias on loopback adapter:

ifconfig lo0 alias

Now we are ready to start the slave controller process, pointing it to the second directory:

[code]./bin/domain.sh \
-Djboss.domain.master.address= \
-Djboss.bind.address= \
-Djboss.bind.address.management= \

After a while the main controller registers it:

[Host Controller] 12:59:57,260 INFO  [org.jboss.as.domain] (domain-mgmt-handler-thread – 1) JBAS010918: Registered remote slave host “slave.local”, JBoss AS 7.1.2.Final-SNAPSHOT “Brontes”

This means the domain including both “hosts” (aka ‘master’ and ‘slave.local’) is up and running. The same steps would be necessary to create a domain with two physical distinct hosts.

For more information please consult the JBoss AS7 Administration Guide:

Stay tuned,