> On Dec 12, 2023, at 09:11, Manak Bisht <[email protected]> wrote:
>
> Hi, is it possible to use values passed as arguments through
> *JAVA_OPTS *or *CATALINA_OPTS
> *in the *server.xml*?
Yes. For example, setting the port number in server.xml for the default
connector:
<Connector port="${test_port:-8080}" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
maxParameterCount="1000"
/>
And using the following in setenv.sh:
CATALINA_OPTS="-Dtest_port=9090”
results in Tomcat listening on port 9090 rather than 8080. Removing the
CATALINA_OPTS setting restores the port to its default.
This is described somewhat tersely here:
https://tomcat.apache.org/tomcat-10.1-doc/config/systemprops.html
- Chuck