Changing default ports in Jboss

The Jboss port configuration is defined by the ServiceBindingManager service of JBoss.  There could be scenarios where you might want to change the default JBoss server ports. The Jboss Web Server by default runs on port 8080 and a set of other services run on a predefined set of ports which is specified in the server/default/conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml.

You can change the default ports in two ways.

1. Specifying as VM Parameter.

Start JBoss with the VM parameter jboss.service.binding.set set to either ports-defaultports-01,ports-02 etc. For example:

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

 

2.Edit the ServiceBinding configuration file.

This requires to manually edit the server/default/conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml

Note: This file defines the default port bindings specified by “ports-default

<!– The name of the set of bindings to use for this server –>

<parameter>${jboss.service.binding.set:ports-default}</parameter>

You can change the default ports by any of the below values.

ports-01 : Has 100 as an offset port

ports-02 : Has 200 as an offset port

ports-03: Has 300 as an offset port.

A sample entry in the file would look like below.

**********************************************************************

 

<!-- The ports-default bindings are obtained by taking the base bindings and adding t0 to each port value  -->

<bean name="PortsDefaultBindings"  class="org.jboss.services.binding.impl.ServiceBindingSet">

<constructor>

<!--  The name of the set -->

<parameter>ports-default</parameter>

<!-- Default host name -->

<parameter>${jboss.bind.address}</parameter>

<!-- The port offset -->

<parameter>0</parameter>

<!-- Set of bindings to which the "offset by X" approach can't be applied -->

<parameter><null/></parameter>

</constructor>

</bean>

 

**********************************************************************

Now if you want to change the default ports specify the below entry.

 

<parameter>${jboss.service.binding.set:ports-01}</parameter>

 

Changing the configuration manually is a tedious process and requires some other xml files to be changed. However it is recommended to follow the first approach.

For more on Service Binding Manager, refer below link.

http://docs.redhat.com/docs/en-US/JBoss_Enterprise_Web_Platform/5/html/Getting_Started_Guide/The_Service_Binding_Manager.html

Cheers,

Wonders Team. 🙂