« Changing Default Port Numbers in JBoss AS 5.x | Main | Verifying SSL Ciphers »

01/04/2009

Changing Default Port Numbers in JBoss AS 4.x

This post has been converted into a HOWTO document, which covers JBoss 4.x and 5.x. See HOWTO: Change Port Numbers in JBoss for more information.
Port number assignments in JBoss application server 4.0 can be managed through the use of the Bindings Manager. The JBoss Bindings Manager can be loaded as part of jboss-service.xml for your server instance. For the example in this article, I will use the jboss-service.xml from the "default" server instance.

Remove the comments surrounding the Binding Manager configuration from your server's jboss-service.xml so that the following is displayed:
 <mbean code="org.jboss.services.binding.ServiceBindingManager"
name="jboss.system:service=ServiceBindingManager">
<attribute name="ServerName">ports-01</attribute>
<attribute name="StoreURL">${jboss.home.url}/docs/examples/binding-manager/sample-bindings.xml</attribute>
<attribute name="StoreFactoryClassName">
org.jboss.services.binding.XMLServicesStoreFactory
</attribute>
</mbean>

Note that the ServerName parameter is utilizing ports-01. Note also that the StoreURL parameter is presently pointing to a sample configuration file. Open that file up in your editor now. This file contains four port configuration sections. Each port is incremented by 100 from the previous set of ports. For example, the default ajp port is 8009. The port number assigned to this set in the ports-01 configuration is 8109, the number assigned in the ports-02 configuration is 8209, etc. The default http port is 8080. This is set to 8180 in the ports-01 configuration, 8280 in the ports-02 configuration—you get the idea.

Save this file to your server's conf directory as binding-manager.xml(same location as jboss-service.xml). You do not need to make any changes to this file for this example.

Modify your server instance's jboss-service.xml file and change the StoreURL configuration in the binding manager section from:
${jboss.home.url}/docs/examples/binding-manager/sample-bindings.xml
to:
${jboss.server.base.dir}/${jboss.server.name}/conf/binding-manager.xml

Start up your server and it is now listening on the set of ports from the ports-01 section of the binding-manager.xml file. If you are running JBoss on Windows, depending upon the service wrapper you are using, you might have to delete the service and re-create it. I've seen some service wrappers (like the one that ships with some versions of Covalent Enterprise Ready Server for tomcat) that does not re-read configuration updates unless the service is removed and re-installed.

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a01156fbc6fe6970c011572288310970b

Listed below are links to weblogs that reference Changing Default Port Numbers in JBoss AS 4.x:

Comments