How to change JBoss 5.1 default port

In order to run JBoss 5.1 with a different port from the default one (8080), an easy but efficient solution is to execute run.sh or run.bat with adding the following instruction on the command line:

-Djboss.service.binding.set=ports-01

To better understand what’s going on, just open file

{JBOSS_DIR}\{PROFILE}/conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml

then look at the following lines:

As you can guess, ports-01 it nothing but a bean with mapped values:

where on the default port will be added the X offset of 100, and the listening HTTP port will result on a 8180 value.

PLEASE NOTICE

If you receiving some JNDI error (something like ‘can’t listen to 1099 port), you’ll probabily have an already deployed application that listen to this port;
remember to configure the application properties in the same way as above (i.e. the JNDI port will be the 1099)