I am trying to set the environment variables GEOSERVER_MODULE_SYSTEM_ENVIRONMENT_STATUS_ENABLED=true
and GEOSERVER_MODULE_SYSTEM_PROPERTY_STATUS_ENABLED=true
on our development installation of GeoServer so I can see the environment and java system properties from the GeoServer web admin Server Status > Modules tab. I can see them set in my system environment variables when I run printenv
on my machine, but GeoServer still does not allow me to view the environment or java system properties from Server Status > Modules tab.
System:
- RHEL 9
- Tomcat 9.0.87
- GeoServer 2.25.3
- OpenJDK Java 11 / JVM Version: 11.0.24+8-LTS
To set the environment variables, as the root user on the machine, I have made an shell script and added it to /etc/profile.d
. The script is called geoserver.sh
and it looks like this:
export GEOSERVER_MODULE_SYSTEM_ENVIRONMENT_STATUS_ENABLED=true
export GEOSERVER_MODULE_SYSTEM_PROPERTY_STATUS_ENABLED=true
I then logged out and logged back in, ran printenv
and saw the two environment variables appear as I expected. I restarted tomcat and then logged into our web admin interface and still I get the same message when trying to view the System Environment module popup and the System Properties module popup:
Environment variables hidden for security reasons. Set the environment variable 'GEOSERVER_MODULE_SYSTEM_ENVIRONMENT_STATUS_ENABLED' to 'true' to see them.
Java system properties hidden for security reasons. Set the environment variable 'GEOSERVER_MODULE_SYSTEM_PROPERTY_STATUS_ENABLED' to 'true' to see them.
Am I adding the environment variables in the wrong place? I'm not sure what to do here. I have tried adding them as JAVA_OPTS
and CATALINA_OPTS
in Tomcat and it didn't work either (not that I expected it to).
I did log in as a different user other than root and ran printenv
and can still see the GEOSERVER env variables set, so it stands to reason that the tomcat user (a non-login user) that runs GeoServer should also be able to see them. I don't get why GeoServer doesn't.
If I run the command that the documentation I linked to earlier says to get a list of environment variables (tr '\0' '\n' < /proc/${GEOSERVER_PID}/environ
), I get this list which suggests environment variables aren't being set at GeoServer startup... but I don't get where I would set them then.
SECURITY_MANAGER=false
JAVA_HOME=/usr/lib/jvm/jre
TOMCAT_CFG_LOADED=1
JAVA_OPTS=-Djavax.sql.DataSource.Factory=org.apache.commons.dbcp.BasicDataSourceFactory
NAME=
PWD=/usr/share/tomcat
LOGNAME=tomcat
SYSTEMD_EXEC_PID=2799947
HOME=/usr/share/tomcat
LANG=en_US.UTF-8
TOMCATS_BASE=/var/lib/tomcats/
INVOCATION_ID=f184a53cc970459eb7757bf289220a38
CATALINA_HOME=/usr/share/tomcat
USER=tomcat
SHLVL=0
JDK_JAVA_OPTIONS= --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-
CATALINA_TMPDIR=/var/cache/tomcat/temp
JOURNAL_STREAM=8:57568628
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
OLDPWD=/
My Tomcat installation does not include files like catalina.sh
or startup.sh
or setenv.sh
because it's RHEL 9 which uses system.d
for configuration. Instead things like CATALINA_OPTS or JAVA_OPTS are set in /etc/tomcat/tomcat.conf
or a custom file in /etc/tomcat/conf.d/yourcustomstuff.conf
. I already tried that. And those aren't "environment variables" anyway, those are java system properties which is not what the documentation is stating GEOSERVER_MODULE_SYSTEM_ENVIRONMENT_STATUS_ENABLED
and GEOSERVER_MODULE_SYSTEM_PROPERTY_STATUS_ENABLED
are.