Running JBoss on non-default port

Often we come across situations in which we have to use non-default ports either for multiple servers; or for multiple instance of the same server.
(Apart from the option to fiddle with the configuration files,) JBoss provides a smart way to run it on non-default ports. Apparently, JBoss comes with predefined port sets that can be used using the property jboss.service.binding.set.

Here’s how you do it:

$ ./run.sh -Djboss.service.binding.set=ports-01

This would add an offset of 100 to the default ports. So this JBoss would be accessible at port 8180. Similary, ports-02 would make it available on 8280 and so on..
There’s also an option of passing ports-default parameter that would make it available on — you guessed it — 8080.

This is much smarter a way than changing XMLs!