How does JBoss choose which AJP port to use?

Rich picture Rich · Aug 10, 2010 · Viewed 7.9k times · Source

In JBoss 5.1.0, there is a file called <INSTANCE>/conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml 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.

In addition, there is <INSTANCE>/deploy/jbossweb.sar/server.xml which lets you set the ports explicitly.

I am running two instances of JBoss on the same box.

  • Instance 1: server.xml is set to use port 8009 for AJP, and bindings-jboss-beans.xml has a zero offset.
  • Instance 2: server.xml is set to use port 8109 for AJP, and bindings-jboss-beans.xml has an offset of 100.

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.

From what I can see, the AJP port is chosen by the value in server.xml rather than any value in bindings-jboss-beans.xml. Is this definitely the case? Is the XSLT inside bindings-jboss-beans.xml a relic from JBoss 4?

Thanks

Rich

Answer

Rich picture Rich · Aug 19, 2010

I finally got round to running a few experiments, and can now answer my own question.

If the port is set to 8009 in server.xml, then the offset in bindings-jboss-beans.xml is applied, otherwise the port set in server.xml is used.