JBoss.org Community Documentation
JBoss ships with service binding configuration file for starting up to three separate JBoss instances on one host. Here we will walk through the steps to bring up the two instances and look at the sample configuration. Start by making two server configuration file sets called jboss0
and jboss1
by running the following command from the book examples directory:
[examples]$ ant -Dchap=misc -Dex=1 run-example
This creates duplicates of the server/production
configuration file sets as server/jboss0
and server/jboss1
, and then replaces the conf/jboss-service.xml
descriptor with one that has the ServiceBindingManager
configuration enabled as follows:
<mbean code="org.jboss.services.binding.ServiceBindingManager" name="jboss.system:service=ServiceBindingManager"> <attribute name="ServerName">${jboss.server.name}</attribute> <attribute name="StoreURL">${jboss.server.base.dir}/misc-ex1-bindings.xml</attribute> <attribute name="StoreFactoryClassName"> org.jboss.services.binding.XMLServicesStoreFactory </attribute> </mbean>
Here the configuration name is ${jboss.server.name}
. JBoss will replace that with name of the actual JBoss server configuration that we pass to the run script with the -c
option. That will be either jboss0
or jboss1
, depending on which configuration is being run. The binding manager will find the corresponding server configuration section from the misc-ex1-bindings.xml
and apply the configured overrides. The jboss0
configuration uses the default settings for the ports, while the jboss1
configuration adds 100 to each port number.
To test the sample configuration, start two JBoss instances using the jboss0
and jboss1
configuration file sets created previously. You can observe that the port numbers in the console log are different for the jboss1
server. To test out that both instances work correctly, try accessing the web server of the first JBoss on port 8080 and then try the second JBoss instance on port 8180.