1 Reply Latest reply on Dec 13, 2004 3:59 PM by randysknt

    Run-time configuration of Tomcat port

    randysknt

      We sometimes run multiple instances of our application on one machine, each with its own jmx-console on a different port. With a JBoss upgrade, we are migrating from Jetty to Tomcat 5.0

      In Jetty, each instance of the application could be launched with different script files that set a different 'jetty.port' environment variable with the following connector config:



      My question is - how would I go about doing this in Tomcat? If we were launching the standalone Tomcat, it would be possible to specify a different server.xml config file, but even that seems like more work than it ought to be.

      It would be great if we could use environment variables in JBoss config files (like we can with ${jboss.bind.address}). Is there a way we can do this so our config can be something like?
      <Connector port="${env.tomcat.port}" address="${jboss.bind.address}"

      Or is there another solution we overlooked?

      Thanks!

      -Randy

        • 1. Re: Run-time configuration of Tomcat port
          randysknt

          I answered my own question:

          If you want JBoss configuration (works for 3.2+, not sure about 3.0) to use a particular environment variable instead of a hardcoded value, just reference it with ${environment.variable.name}

          For example, to run multiple instances on the same machine, each with a JMX-console, you need to make sure each instance of Tomcat binds to a different port. Add:
          -Dtomcat.port=443 to %JAVA_OPTS%

          Then in server.xml:

          Connector port="${tomcat.port}" address="${jboss.bind.address}" scheme = "https" secure = "true"