3 Replies Latest reply on May 19, 2005 1:16 PM by Esteban Brenes

    JBoss binds to random port on startup

    Esteban Brenes Newbie


      I'm currently trying to deploy a site for a client on JBoss. They provided me the source code and configuration files which I've built using their ant build script. JBoss works fine when I don't deploy their application and use a different configuration. However when I run it with the configuration JBoss binds the HTTP server to a random port. It's been anything from 1767, 3306, 4454 to 24445. I'm stumpted as to how to get JBoss to work correctly (i.e., use the ports indicated in the configuration file).

      This is the server.xml currently in jboss-3.2.6/default/deploy/jbossweb-tomcat50.sar/

       <Service name="jboss.web"
       <!-- A HTTP/1.1 Connector on port 9090 -->
       <Connector port="9090 " address="${jboss.bind.address}"
       maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
       enableLookups="false" redirectPort="9443" acceptCount="100"
       connectionTimeout="20000" disableUploadTimeout="true"/>
       <!-- A AJP 1.3 Connector on port 20009 -->
       <Connector port="20009" address="${jboss.bind.address}"
       enableLookups="false" redirectPort="9443" debug="0"
       ... [omitted rest of server.xml] ...

      This is my first time working with JBoss, and could use some help in sorting out the problem. If you need other configuration files or output from the server.log or boot.log please let me know.


        • 1. Re: JBoss binds to random port on startup
          Esteban Brenes Newbie

          Looking further into the problem I found the jboss-service.xml in the conf directory, which has the following bit of code:

          <mbean code="org.jboss.services.binding.ServiceBindingManager"
           <attribute name="ServerName">ports-01</attribute>
           <attribute name="StoreURL">../docs/examples/binding-manager/sample-bindings.xml</attribute>
           <attribute name="StoreFactoryClassName">

          looking at the sample-bindings.xml i found this:
          <!-- jbossweb-tomcat50.sar -->
           <service-config name="jboss.web:service=WebServer"
           <xslt-config configName="ConfigFile"><![CDATA[
           xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
           <xsl:output method="xml" />
           <xsl:param name="port"/>
           <xsl:variable name="portAJP" select="$port - 71"/>
           <xsl:variable name="portHttps" select="$port + 363"/>

          Particularly, the last two lines caught my attention as it would seem at first glace it's taking some random port ? and substracting a set number from it and adding a set number to it, to get some random configuration. I'll have to test if I see this number pattern in the port assingments i'm seeing.

          Could this be part of the problem?

          • 2. Re: JBoss binds to random port on startup
            Darran Lofthouse Master

            Unless you have enabled the binding manager service the configuration file that you have found will not be used so is not related to your problem.

            The extract that you have found does not assign random ports, it is used to make sure that different instances have different known ports.

            • 3. Re: JBoss binds to random port on startup
              Esteban Brenes Newbie

              Okay. Then I guess that's not it.

              I'm basically running the standard default config that comes with the 3.2.6 package, with modifications done to the following files:


              The only changes in those files have been to the port numbers from the default ones.