You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Vikram Vaswani <vi...@gmail.com> on 2010/11/03 04:32:45 UTC

Deploying Tomcat app with Ant to non-webapps location (Windows)

Hello

I am new to Tomcat and request help with the following problem on
Tomcat/Windows.

My Tomcat installation is at C:\program files\Tomcat

I have created an application as per the instructions in the Tomcat
Application Developer's Guide and am able to build and deploy it using
Ant. When deployed, the application ends up at C:\program
files\Tomcat\lcs (lcs is the application name).

I would however like to have the application deployed to a different
path ie. c:\lcs.

I am able to do this manually, by creating a separate context file in
Catalina/localhost/lcs.xml and specifying the C:\lcs path as the
Context docbase. However, I would like this to happen automatically.

I read that if I place the context fragment in my applications
META-INF/context.xml file, then this should happen automatically.
However, despite doing this, the application is still always deployed
to C:\program files\Tomcat\webapps\lcs instead of C:\lcs.

Any advice would be appreciated. TIA.

Vikram

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Deploying Tomcat app with Ant to non-webapps location (Windows)

Posted by Pid <pi...@pidster.com>.
On 03/11/2010 06:24, Caldarale, Charles R wrote:
>> From: Vikram Vaswani [mailto:vikram.melonfire@gmail.com] 
>> Subject: Deploying Tomcat app with Ant to non-webapps location (Windows)
> 
>> When deployed, the application ends up at C:\program
>> files\Tomcat\lcs (lcs is the application name).
> 
> Not an appropriate spot, so it's good that you want to move it.  Better if it were in C:\Program Files\Tomcat\webapps\lcs.
> 
>> I am able to do this manually, by creating a separate context file in
>> Catalina/localhost/lcs.xml and specifying the C:\lcs path as the
>> Context docbase. However, I would like this to happen automatically.
> 
> What do you want to happen automatically?  Once the application and the lcs.xml file are in place, the next deployment should consist only of copying the new version on top of the old one - the <Context> element in Catalina/[host]/[appName].xml need not change.
> 
>> I read that if I place the context fragment in my applications
>> META-INF/context.xml file, then this should happen automatically.
> 
> Still don't know what you want to happen.  


Me either.  Were I to hazard a guess, I'd suggest changing the appBase
to a different location, but having said that - I think setting
appBase="C:\" is a bad idea.


p

Re: Deploying Tomcat app with Ant to non-webapps location (Windows)

Posted by David kerber <dc...@verizon.net>.
On 11/3/2010 1:02 PM, Vikram Vaswani wrote:
> Hi David,
>
>>> When you say "your script", which script do you mean? I'm using the
>>> standard Ant build.xml that's shown in the Tomcat online docs.
>>
>> That's the script you need to change; point it to where you want your app to
>> end up.
>
> Can you suggest which properties I should change in this file or point
> me to a link that shows how to change it? The one I'm using right now
> is this one, which is the default one shown in the Tomcat docs:
> http://tomcat.apache.org/tomcat-7.0-doc/appdev/build.xml.txt

I don't use ant, but from a quick look, I would guess it's the dist.home 
property.  Or it may need a new one telling it where to copy everything 
once it's done building.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Deploying Tomcat app with Ant to non-webapps location (Windows)

Posted by Vikram Vaswani <vi...@gmail.com>.
Hi David,

>> When you say "your script", which script do you mean? I'm using the
>> standard Ant build.xml that's shown in the Tomcat online docs.
>
> That's the script you need to change; point it to where you want your app to
> end up.

Can you suggest which properties I should change in this file or point
me to a link that shows how to change it? The one I'm using right now
is this one, which is the default one shown in the Tomcat docs:
http://tomcat.apache.org/tomcat-7.0-doc/appdev/build.xml.txt

Vikram

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Deploying Tomcat app with Ant to non-webapps location (Windows)

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Vikram,

On 11/3/2010 9:09 AM, Vikram Vaswani wrote:
> Hi David,
> 
>>> When you say "your script", which script do you mean? I'm using the
>>> standard Ant build.xml that's shown in the Tomcat online docs.
>>
>> That's the script you need to change; point it to where you want your app to
>> end up.
> 
> Can you suggest which properties I should change in this file or point
> me to a link that shows how to change it? The one I'm using right now
> is this one, which is the default one shown in the Tomcat docs:
> http://tomcat.apache.org/tomcat-7.0-doc/appdev/build.xml.txt

Unfortunately for you, this ant script is rigged to use the <deploy>
task which actually uploads your webapp to Tomcat for deployment. Tomcat
will not put your uploaded file into C:\lcs.

Instead, I think you'll have to modify the "install" target instead to
explode your WAR file into your preferred location. Try removing the
entire contents of the "install" target and replacing them with this:

<!-- Make sure you have install.target.dir set to C:\lcs

<copy toDir="${install.target.dir}">
  <fileset dir="${build.home}" includes="**/*" />
</copy>

This will simply copy your built webapp into C:\lcs. You may have to
"touch" the deployment XML file under
CATALINA_BASE/conf/Catalina/localhost/lcs.xml in order to trigger a
redeploy.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkzcSY0ACgkQ9CaO5/Lv0PDFtwCfQqaRbDzmBNRLbIUdLMtzpJ+O
arkAniDt3v4Pu4xSlRHG6d1ZxomIeKLD
=yzgH
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Deploying Tomcat app with Ant to non-webapps location (Windows)

Posted by Vikram Vaswani <ba...@vsnl.com>.
Hi David,

>> When you say "your script", which script do you mean? I'm using the
>> standard Ant build.xml that's shown in the Tomcat online docs.
>
> That's the script you need to change; point it to where you want your app to
> end up.

Can you suggest which properties I should change in this file or point
me to a link that shows how to change it? The one I'm using right now
is this one, which is the default one shown in the Tomcat docs:
http://tomcat.apache.org/tomcat-7.0-doc/appdev/build.xml.txt

Vikram

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Deploying Tomcat app with Ant to non-webapps location (Windows)

Posted by David kerber <dc...@verizon.net>.
On 11/3/2010 5:26 AM, Vikram Vaswani wrote:
> Hi Charles,
>
>>> I am able to do this manually, by creating a separate context file in
>>> Catalina/localhost/lcs.xml and specifying the C:\lcs path as the
>>> Context docbase. However, I would like this to happen automatically.
>>
>> What do you want to happen automatically?  Once the application and the lcs.xml file are in place, the next deployment should consist only of copying the new version on top of the old one - the<Context>  element in Catalina/[host]/[appName].xml need not change.
>
> Sorry if I wasn't clear. Let me try to explain better:
>
> By default, when I compile and install the application named 'lcs'
> with Ant, it is installed to the Tomcat webapps directory. So the path
> is $Tomcat\webapps\lcs.
>
> I would instead like to have it installed to c:\lcs
>
> I would also like requests for /lcs to be served from the c:\lcs directory.
>
> I'm able to do this manually: I copy the application manually from
> $Tomcat\webapps\lcs to c:\lcs, set up an lcs.xml context fragment in
> Catalina/localhost, and it works the way I want it to.
>
> However, when I next compile and install the app with Ant, it is again
> deployed to $Tomcat\webapps\lcs, when instead I'd like it to go to
> c:\lcs.
>
> Does that make sense? From my reading of the manual, it seems like
> this is possible but I'm not able to get it working in practice.
>
>>> However, despite doing this, the application is still always deployed
>>> to C:\program files\Tomcat\webapps\lcs instead of C:\lcs.
>>
>> So fix your script to copy the webapp to the desired location.
>
> When you say "your script", which script do you mean? I'm using the
> standard Ant build.xml that's shown in the Tomcat online docs.

That's the script you need to change; point it to where you want your 
app to end up.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Deploying Tomcat app with Ant to non-webapps location (Windows)

Posted by Vikram Vaswani <vi...@gmail.com>.
Hi Charles,

>> I am able to do this manually, by creating a separate context file in
>> Catalina/localhost/lcs.xml and specifying the C:\lcs path as the
>> Context docbase. However, I would like this to happen automatically.
>
> What do you want to happen automatically?  Once the application and the lcs.xml file are in place, the next deployment should consist only of copying the new version on top of the old one - the <Context> element in Catalina/[host]/[appName].xml need not change.

Sorry if I wasn't clear. Let me try to explain better:

By default, when I compile and install the application named 'lcs'
with Ant, it is installed to the Tomcat webapps directory. So the path
is $Tomcat\webapps\lcs.

I would instead like to have it installed to c:\lcs

I would also like requests for /lcs to be served from the c:\lcs directory.

I'm able to do this manually: I copy the application manually from
$Tomcat\webapps\lcs to c:\lcs, set up an lcs.xml context fragment in
Catalina/localhost, and it works the way I want it to.

However, when I next compile and install the app with Ant, it is again
deployed to $Tomcat\webapps\lcs, when instead I'd like it to go to
c:\lcs.

Does that make sense? From my reading of the manual, it seems like
this is possible but I'm not able to get it working in practice.

>> However, despite doing this, the application is still always deployed
>> to C:\program files\Tomcat\webapps\lcs instead of C:\lcs.
>
> So fix your script to copy the webapp to the desired location.

When you say "your script", which script do you mean? I'm using the
standard Ant build.xml that's shown in the Tomcat online docs.

Thanks,

Vikram

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Deploying Tomcat app with Ant to non-webapps location (Windows)

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Vikram Vaswani [mailto:vikram.melonfire@gmail.com] 
> Subject: Deploying Tomcat app with Ant to non-webapps location (Windows)

> When deployed, the application ends up at C:\program
> files\Tomcat\lcs (lcs is the application name).

Not an appropriate spot, so it's good that you want to move it.  Better if it were in C:\Program Files\Tomcat\webapps\lcs.

> I am able to do this manually, by creating a separate context file in
> Catalina/localhost/lcs.xml and specifying the C:\lcs path as the
> Context docbase. However, I would like this to happen automatically.

What do you want to happen automatically?  Once the application and the lcs.xml file are in place, the next deployment should consist only of copying the new version on top of the old one - the <Context> element in Catalina/[host]/[appName].xml need not change.

> I read that if I place the context fragment in my applications
> META-INF/context.xml file, then this should happen automatically.

Still don't know what you want to happen.  The META-INF/context.xml location for the webapp's <Context> element is useful only when the webapp is located in the <Host> appBase directory.  Note that the docBase attribute is illegal when the <Context> element is in META-INF/context.xml.

> However, despite doing this, the application is still always deployed
> to C:\program files\Tomcat\webapps\lcs instead of C:\lcs.

So fix your script to copy the webapp to the desired location.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org