tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Arnone, Anthony" <>
Subject RE: context-relative path in JNDI variables
Date Tue, 11 Sep 2007 21:42:17 GMT
What I'm trying to do is a slightly strange. Let me see if I can explain it a different way.

I'd like to be able to use Tomcat's auto deploy feature of the manager to simply copy the
war into the webapps directory, and have the context come up correctly with its solr home
set appropriate to its deploy-time name. Something like this:

$ cp solr-master.war ${CATALINA_HOME}/webapps/solr-001.war
$ cp solr-master.war ${CATALINA_HOME}/webapps/solr-002.war

and then have access to


Essentially, I might not have access to ant at deploy time, nor have the ability to change
the master war itself. This means that I won't be able to change the context.xml or the web.xml
files, since they will already be packaged inside the war archive. So, is there some way to
generic-ify the context fragment?


-----Original Message-----
From: Christopher Schultz [] 
Sent: Tuesday, September 11, 2007 3:30 PM
To: Tomcat Users List
Subject: Re: context-relative path in JNDI variables

Hash: SHA1


Arnone, Anthony wrote:
> I’m trying to set a system where I can deploy a single .war under
> multiple context names (using the ant deploy extensions).

Ooh! I love these things.

> ant -Ddeploy-path=/app-01 deploy
> ant -Ddeploy-path=/app-02 deploy

How about:

ant -Dcontext-name=app-01 deploy
ant -Dcontext-name=app-02 deploy

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

Then you can just use:

        override="true" />

Make sure that you turn on the appropriate filter when copying (or
generating) your context.xml file so that ${context-name} gets expanded.

> <env-entry>
> <env-entry-name>solr/home</env-entry-name>
> <env-entry-type>java.lang.String</env-entry-type>
> <env-entry-value>
> webapps/${}/app-01/solr/</env-entry-value>
> </env-entry>

Using web.xml might be a little bit more platform-neutral. The strategy
would be the same.

> This allows for a much simpler deployment, where
> no context.xml needs to be generated and packaged into the war at
> deploy time.

Really? How do you deploy a WAR file without a context.xml file? Or, do
you not need Tomcat to provide anything specific like a JNDI data source?

> 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?

No, but you can just change the way you think about the variable and
alter your scripts accordingly.

- -chris
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla -


To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message