tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Arnone, Anthony" <aarn...@rightnow.com>
Subject context-relative path in JNDI variables
Date Tue, 11 Sep 2007 20:39:26 GMT
Hello all,

 

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

 

ant -Ddeploy-path=/app-01 deploy

ant -Ddeploy-path=/app-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. The application being deployed (in this case it’s
Solr) needs one variable to be defined in either a context fragment in META-INF/context.xml
or defined in WEB-INF/web.xml. The variable is solr/home, and it 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?

 

Thanks, any help would be appreciated.

Anthony Arnone

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message