Hello all,

 

I sent this message to the Tomcat users group, and I was wondering if I’d have 
any more luck by asking people who might have had this problem: 

 

I’m trying to set up a system where I can deploy a single .war under multiple 
context names (using the ant deploy extensions). For example:

 

ant -Ddeploy-path=/solr-01 deploy

ant -Ddeploy-path=/solr-02 deploy

 

Both deploy commands use the same .war. However, I’m trying to do something 
that I’ve been unable to find a proper method for. solr/home points to a 
directory that is packed inside the .war. So, I would like to have a context 
fragment that looks like this:

 

In META-INF/context.xml

 

<Context>

    <Environment name="solr/home" type="java.lang.String" 
value="webapps/${context.name}/app-01/solr/" override="true" />

</Context>

 

Or in WEB-INF/web.xml

 

<env-entry>

    <env-entry-name>solr/home</env-entry-name>

    <env-entry-type>java.lang.String</env-entry-type>

    <env-entry-value> webapps/${context.name}/app-01/solr/</env-entry-value>

</env-entry>

 

As you can see, I’ve used a variable called ${context.name}, so that the 
different contexts can use the same fragment, but be named something different. 
This allows for a much simpler deployment, where no context.xml needs to be 
generated and packaged into the war at deploy time. Unfortunately,  as far as I 
know, a variable like this does not exist. So my question is this, is there a 
way to specify a variable like this relative to the context root? Currently I 
am experimenting with adding something to the config that makes solr home 
relative to the getServletContext.getRealPath(). Is this my only option?

 

 

Thanks, any help would be appreciated.

Anthony Arnone

Reply via email to