I am having hard time setting JAVA_OPTS for RedHat environment for tomcat 8. I need to load properties outside the tomcat install directory. The folder structure:
----/home/tomcat
-----/apache-tomcat-8
-----/remoteProperties
I want to load the properties from the remote properties folder.
Here is the setenv.sh
file content:
JAVA_OPTS="$JAVA_OPTS -DPropertyPath=/home/tomcat/remoteProperties/collections"
After deploying my war file it seems that this path is not correctly set:
FileNotFoundExcetpion
/home/tomcat/apache-tomcat-8.0.41/bin/home/tomcat/remoteProperties/collections/properties/logging/logback.xml
As soon as I change content of setenv.sh
and use relative path instead of absolute path:
JAVA_OPTS="$JAVA_OPTS -DPropertyPath=../../remoteProperties/collections"
It works as expected. Is it possible to set absolute path in JAVA_OPTS? Thank you!
After debugging the application I noticed that FileSystemResourceLoader
spring class is used to obtain some resources. Then I read in the documentation that it is mandatory to put prefix file:
when using absolute path. Then I just had to change the content of setenv.sh
script to:
JAVA_OPTS="$JAVA_OPTS -DPropertyPath=file:/home/tomcat/remoteProperties/collections"