java - How to place configuration file for Tomcat with several virtual hosts? -
i've got tomcat (7 or 8) 2 virtual hosts 2 clones of application should work.
each application should have it's own configuration file. , shouldn't placed in *.war - somewhere in server environment.
when have single application in tomcat, can place configuration file in
<context:property-placeholder location="file:${catalina.home}/conf/myapp.properties"/>
this how spring find configuration file due applicationcontext.xml.
but when have 2 hosts, should place configuration files in different directories. i've added context attribute in host in server.xml
<context docbase="" path="xxx"> <environment name="app.name" value="myapp1" type="java.lang.string" override="false"/> </context>
here first host gets environment variable "app.name" "myapp1". second host gets variable "myapp2" value. i've modified
but tomcat falls filenotfoundexception
context initialization failed org.springframework.beans.factory.beaninitializationexception: not load properties; nested exception java.io.filenotfoundexception: ...\conf\${app.name}\myapp.properties (the system cannot find path specified)
why?
the environment property have configured jndi lookup property. not think can read normal system property in case of "catalina_home".
environment - configure names , values scalar environment entries exposed web application through jndi initialcontext (equivalent inclusion of <env-entry>
element in web application deployment descriptor).
Comments
Post a Comment