catelina.properties中的$ {catalina.base}未被CATALINA_BASE取代

时间:2014-09-10 08:42:30

标签: java tomcat

我得到异常FileNotFoundException,因为$ {catalina.base}尚未转换为CATALINA_BASE的值

Caused by: java.io.FileNotFoundException: ${catalina.base}/conf/fourf.properties (No such file or directory)

我在catelina.properties中添加了一个属性FOURF_JAVA_CONFIGURATION

FOURF_JAVA_CONFIGURATION=${catalina.base}/conf/fourf.properties

启动tomcat时会记录:

Using CATALINA_BASE:   /usr/share/tomcat_appserver
Using CATALINA_HOME:   /usr/share/tomcat_appserver
Using CATALINA_TMPDIR: /usr/share/tomcat_appserver/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /usr/share/tomcat_appserver/bin/bootstrap.jar

我原本期望FOURF_JAVA_CONFIGURATION具有值/usr/share/tomcat_appserver/conf/fourf.properties。为什么不会发生这种情况?

1 个答案:

答案 0 :(得分:0)

我通过在我的代码中添加以下行来实现它:

configurationPath = configurationPath.replace("${catalina.base}", System.getProperty("catalina.base"));

我设想在哪里可以自动替换$ {catalina.base},但显然不是