Dear Maintainer, there is no way to set CATALINA_OPTS environment variable to be used by catalina.sh startup script. As described in catalina.sh source: # CATALINA_OPTS (Optional) Java runtime options used when the "start", # "run" or "debug" command is executed. It is working in tomcat8 package from Debian 9 by setting CATALINA_OPTS in /etc/default/tomcat8.
Le 2020-04-15 14:35, Radosław Józwik a écrit : Hi Radosław, you should use JAVA_OPTS instead of CATALINA_OPTS in /etc/default/tomcat9 as documented in the file. I don't think CATALINA_OPTS has ever been intended to be supported in /etc/default/tomcat<n>. Emmanuel Bourg
Le 2020-04-15 14:35, Radosław Józwik a écrit : Hi Radosław, you should use JAVA_OPTS instead of CATALINA_OPTS in /etc/default/tomcat9 as documented in the file. I don't think CATALINA_OPTS has ever been intended to be supported in /etc/default/tomcat<n>. Emmanuel Bourg
Hello, I'm already using JAVA_OPTS as a workaround, but I thought CATALINA_OPTS should be supported as it is in Tomcat8 package. Nevertheless if JAVA_OPTS should be used then I will migrate completely and this bug report can be closed. Regards, Radosław
Reading this discussion, I see that at the moment there is not any official way to declare and expose an environment variable to "catalina.sh". I mean, for example, if you need to define this env: (note, it's not a system property): MY_CUSTOM_APPLICATION_SECRET=123 In short, this is the current situation of this package AFAIK: 1. Any extra "Environment=FOO=BAR" variable set from systemd is ignored. (Also if you force that with PassEnvironment=FOO) Feature? Probably yes. 2. Any extra environent variable set from /etc/default/tomcat9 is NOT exposed to "bin/catalina.sh". Feature? Probably yes. [MOST IMPORTANT POINT] 3. The supposed path to declare an extra env variable should be "bin/setenv.sh", but, this is in a read-only location as per FHS and so it's NOT supposed to be customized. Feature? Probably NO. If I'm correct: It would probably make sense to discuss the issue n. 3. For example, allowing a file such as "setenv.sh" to be created in an officially writable location would probably make sense.
I just want to mention that, I don't see ANY way at all to expose any custom environment variable to the Tomcat process itself. Feature? Unsure. AFAIK If you push an environment variable inside your catalina.sh, (for example via the previously mentioned setenv.sh), that variable just die in catalina.sh and - it seems to me - it is never exposed to the Tomcat's Bootstrap process. I'd just be curious if what I'm saying makes sense.