Running the JBoss Messaging Examples

First set the environment variable JBOSS_HOME to point to your JBoss AS installation.

export JBOSS_HOME=/home/jboss/jboss-eap-4.3/jboss-as

To run the clustering examples, you will need to create a copy of the all configuration.  Use the following commands.
cd $JBOSS_HOME/server
cp -r all all2

Now, we need to change the ports that the all2 configuration listens on since you can't have two instances listening on the same ports.
Edit the file $JBOSS_HOME/server/all2/conf/jboss-service.xml.  If you scroll down a bit, you will see the heading "Binding Manager".  Place the following xml snippit below this heading.

   <mbean code="org.jboss.services.binding.ServiceBindingManager"
     name="jboss.system:service=ServiceBindingManager">
     <attribute name="ServerName">ports-01</attribute>
     <attribute name="StoreURL">${jboss.home.url}/docs/examples/binding-manager/sample-bindings.xml</attribute>
     <attribute name="StoreFactoryClassName">
       org.jboss.services.binding.XMLServicesStoreFactory
     </attribute>
   </mbean>

Optionally, you could edit the file $JBOSS_HOME/server/all2/deploy/jboss-messaging.sar/messaging-service.xml.  You should change the ServerPeerID to '1' instead of '0'.  Another way of setting the server peer is with the jboss.messaging.ServerPeerID property as used below.

To start the cluster you can use the following commands:

./run.sh -c all -u 228.3.2.1 
./run.sh -c all2 -u 228.3.2.1 -Djboss.messaging.ServerPeerID=1

At this point, you should be able to run any of the messaging clustering examples.
