title: How does JBoss choose which AJP port to use?
body: <p>In JBoss 5.1.0, there is a file called <code>&lt;INSTANCE&gt;/conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml</code> which includes some settings for applying an offset to the port numbers. This is used to enable multiple instances to run on the same box without going through painful reconfiguration of the ports for each instance. There is also some XSLT in the same file which also modifies the AJP port.</p>
  
  <p>In addition, there is <code>&lt;INSTANCE&gt;/deploy/jbossweb.sar/server.xml</code> which lets you set the ports explicitly.</p>
  
  <p>I am running two instances of JBoss on the same box.</p>
  
  <ul>
  <li>Instance 1: <code>server.xml</code> is set to use port 8009 for AJP, and <code>bindings-jboss-beans.xml</code> has a zero offset.</li>
  <li>Instance 2: <code>server.xml</code> is set to use port 8109 for AJP, and <code>bindings-jboss-beans.xml</code> has an offset of 100.</li>
  </ul>
  
  <p>The XSLT seems to be configured to change the AJP port number when the port is set to be the default (8009). However, that doesn't seem to be happening.</p>
  
  <p>From what I can see, the AJP port is chosen by the value in <code>server.xml</code> rather than any value in <code>bindings-jboss-beans.xml</code>. Is this definitely the case? Is the XSLT inside bindings-jboss-beans.xml a relic from JBoss 4?</p>
  
  <p>Thanks</p>
  
  <p>Rich</p>