In order for JBoss to be used in a clustered environment the HAPartition MBean must be configured with a partition name. This name is used by the HAPartition to identify the set of nodes meant to be within the same cluster. By default the server sets the partition name to DefaultPartition which is fine when you have just one developer but not so useful when you have multiple developers who don't want to form a cluster, or a production system where you don't want random other machines on the network joining the cluster. This wiki explains the 4 steps required in order to alter this to something more meaningful.
First of all you need to think of a meaningful partition name, e.g JBossWikiPartition or MainPortalPartition.
Next you need to ensure that your deploy/cluster-service.xml file does not contain any hard coded reference to DefaultPartition. Instead, use the system property substitution syntax ${jboss.partition.name:DefaultPartition}. This tells the server to use the value held in the VMs jboss.partition.name system property or, if the system property is not set, use the value DefaultPartition.
Next you need to ensure that references in your jboss.xml (see example below) files do not contain hard coded partition names. Instead, use the system property substitution syntax ${jboss.partition.name:DefaultPartition}.
Finally you need to start your server with a -D flag and set the system property value. For example:
%JBOSS_HOME%\bin\run.bat -Djboss.partition.name=Chris
(Beginning with 4.0.3 you can use the -g or --partition command line option instead of setting a system property.)
An example jboss.xml file for an SFSB project is shown below for your information:
<jboss> <enterprise-beans> <session> <ejb-name>GangDispute</ejb-name> <clustered>True</clustered> <cluster-config> <partition-name>${jboss.partition.name:DefaultPartition}</partition-name> <bean-load-balance-policy>org.jboss.ha.framework.interfaces.FirstAvailable</bean-load-balance-policy> </cluster-config> </session> </enterprise-beans> </jboss>
Also see TwoClustersSameNetwork
Comments