I am trying to set some values in server.xml using environment variables. From this https://stackoverflow.com/questions/67214216/how-to-set-org-apache-tomcat-util-digester-environmentpropertysource-in-tomcat, I create setenv.sh file in /tomcat/bin with this:
CATALINA_OPTS="$CATALINA_OPTS -Dorg.apache.tomcat.util.digester.PROPERTY_SOURCE=org.apache.tomcat.util.digester.EnvironmentPropertySource"
When I run tomcat, I get this exception:
org.apache.tomcat.util.digester.Digester.<clinit> Unable to load property source[org.apache.tomcat.util.digester.EnvironmentPropertySource].
I am really new to tomcat, so I have no idea what it means. I am not sure even if it is related to the setenv.sh
. I don't see the same exception without setenv.sh
file. I tried to research on this topic, but not many information was found.
Can anyone please answer why this is happening?
EDIT: here is my whole stack trace from the log file
26-Apr-2021 19:32:44.857 SEVERE [main] org.apache.tomcat.util.digester.Digester.<clinit> Unable to load property source[org.apache.tomcat.util.digester.EnvironmentPropertySource].
java.lang.ClassNotFoundException: org.apache.tomcat.util.digester.EnvironmentPropertySource
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at org.apache.tomcat.util.digester.Digester.<clinit>(Digester.java:97)
at org.apache.catalina.startup.Catalina.createStartDigester(Catalina.java:272)
at org.apache.catalina.startup.Catalina.load(Catalina.java:528)
at org.apache.catalina.startup.Catalina.load(Catalina.java:644)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:311)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:494)
26-Apr-2021 19:32:44.859 SEVERE [main] org.apache.tomcat.util.digester.Digester.<clinit> Unable to load property source[org.apache.tomcat.util.digester.EnvironmentPropertySource].
java.lang.ClassNotFoundException: org.apache.tomcat.util.digester.EnvironmentPropertySource
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at org.apache.tomcat.util.digester.Digester.<clinit>(Digester.java:97)
at org.apache.catalina.startup.Catalina.createStartDigester(Catalina.java:272)
at org.apache.catalina.startup.Catalina.load(Catalina.java:528)
at org.apache.catalina.startup.Catalina.load(Catalina.java:644)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:311)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:494)
The org.apache.tomcat.util.digester.EnvironmentPropertySource
class is available since Tomcat 7.0.108, Tomcat 8.5.65 and Tomcat 9.0.45. You must be running an older release.