I’d like to store the Tomcat v5.5 port in an environment variable and have Tomcat listen on that port. So far the only way I can see to change the port is by amending $CATALINA_HOME/conf/server.xml. Is there a way to set the port value by supplying an external value when starting Tomcat? I’m running Tomcat on Solaris.
Share
Create a script to launch Tomcat. In the launch script, export JAVA_OPTS to specify a value for the Tomcat property
port.http.nonssl(note you can call this property whatever you want).As you can see, I’ve set
port.http.nonsslto the environment variable${CATALINA_BASE_PORT}The script then launches Tomcat:
You now need to change the Tomcat
$CATALINA_HOME/conf/server.xmlfile so the non-SSL HTTP connector uses theport.http.nonsslproperty instead of a hardcoded value.Now Tomcat will use the port defined in the ${CATALINA_BASE_PORT} environment variable whenever you start it via the new launch script.