How to configure Tomcat 9 to load catalina.properties file from catalina.home when catalina.base is a different path?

197 views Asked by At

I upgraded from Tomcat 8.5 to Tomcat 9 and the value I used in 8.5 for the catalina.config property is no longer working.

In Tomcat 8.5 I am able to specify a path to the "catalina.properties" file by using the catalina.config property. In Tomcat 8.5 the catalina.config property only accepts a URL as the path to the catalina.properties file: (https://tomcat.apache.org/tomcat-8.5-doc/config/systemprops.html)

catalina.config --> The URL for the catalina.properties configuration file.

However, in Tomcat 9 there was an adjustment made to the values that catalina.config accepts:

Bug 48543 - [Patch] More flexibility in specifying -Dcatalina.config

and the property description has been update in Tomcat 9 to say: (https://tomcat.apache.org/tomcat-9.0-doc/config/systemprops.html)

catalina.config --> The location from which to load the catalina.properties configuration file. This may be an absolute URL, a relative (to the current working directory) URL or an alternative file name in which case Tomcat will attempt to load the file from the default location of $CATALINA_BASE/conf/.

My Tomcat 8.5 configuration that works: (catalina.base changes depending on which application is "launched")

-Dcatalina.home=c:\Program Files\myProgram
-Dcatalina.base=c:\Program Files\myProgram\mySubProgram
-Dcatalina.config=file://c:/Program Files/myProgram/conf/loader.properties

After upgrading to Tomcat 9, the loader.properties file is no longer being loaded by using the path specified by the catalina.config property.

I have tried several variations of paths, URLs and filenames in the catalina.config property, but haven't been successful in getting Tomcat to load the file from anywhere other than $catalina.home\conf

Things I have tried without any success: (catalina.base and catalina.home are using the values mentioned above)

FAILED: an absolute URL

-Dcatalina.config=file://c:/Program Files/myProgram/conf/loader.properties
OR
-Dcatalina.config=file://c:/Program Files/myProgram/conf/catalina.properties

FAILED: a relative (to the current working directory) URL

-Dcatalina.config=file://../conf/loader.properties
OR
-Dcatalina.config=file://../conf/catalina.properties

WORKS AS DOCUMENTED (but can't be used to load from anywhere other than $catalina.home\conf)

-Dcatalina.config=loader.properties

At this point, I am at a loss. I am unsure if there is a bug I need to report to Tomcat or if I am just not specifying the value properly. Any help is greatly appreciated.

0

There are 0 answers