You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Karsten Wutzke <kw...@web.de> on 2003/04/16 17:19:23 UTC

Re: Installs/deploys to work dir... why?

It's really nothing special. Currently, I'm starting to develop a 
JSP/Servlet web app which connects to a MySQL 4 DB to retrieve 
Basketball statistics of players, games, teams etc. I started with Ant 
to create an automation framework. I'm working on my localhost right 
now, but I want to do the things in a way, so that I can use as much of 
the XML code as possible for bringing the whole thing over to a remote 
server...

For now, I have created two Ant targets, <install-local> and 
<deploy-local> doing the *exactly* the same. I did this just to find out 
which task does what I expect. In the end, both tasks successfully get 
the web app up and running, but in Tomcat directories I did *not* expect.

Here's some code, nothing special (local means Tomcat on the localhost):

<property name="local.manager.url" value="http://localhost:8080/manager"/>
<property name="local.manager.username" value="anything"/>
<property name="local.manager.password" value="anything"/>
<property name="local.context.path" value="/basketball"/>
<property name="dist.file" location="dist/basketball.war"/>

<target name="deploy-local" depends="dist,startup-local">
   <deploy url="${local.manager.url}"
           username="${local.manager.username}"
           password="${local.manager.password}"
           path="${webapp.context.path}"
           war="file://${dist.file}"/>
</target>

<target name="install-local" depends="dist,startup-local">
   <install url="${local.manager.url}"
            username="${local.manager.username}"
            password="${local.manager.password}"
            path="${webapp.context.path}"
            war="file://${dist.file}"/>
</target>

As you can see, the two targets are exactly the same, they just use the 
deploy and install Ant tasks. The dist.file property is the war file the 
"dist" depends task put into the development dist directory before. From 
there the web app war is installed/deployed. The <startup-local> tasks 
ensures local Tomcat is running (to be able to use the Manager app).

To me the whole difference between the <install> and <deploy> is tasks 
is unclear - please enlighten me...

The only differences I can see are:

- the deploy task also copies the war file to the 
$CATALINA_HOME/work/standalone/localhost/manager directory and locks the 
file, so I can't delete it (e.g. with my Explorer)
- when using deploy, the web app is permanently remembered between 
server restarts

I find it pretty strange, not to find the web app war in the webapps 
dir, and the basketball dir, too. Is there anything that might be 
misconfigured? Though I did not edit any files or anything besides 
adding a user/pw combo with the manager role.

Should I simply accept it the way it is? What is going on behind the 
scenes? Are the Ant tasks responsible for this or Tomcat?

Karsten

Morgan Pyne wrote:

> When we use Ant to "deploy" via the manager, the WAR file gets uploaded to:
> 
> {TOMCAT_HOME}/work/_/{VIRTUAL_HOST_NAME}/tomcat4_manager/
> 
> By default, our Tomcat is set not to expand war files, so only the actual WAR 
> archive gets put in there.
> 
> Once we actually access the servlet, the files are extracted into:
> 
> {TOMCAT_HOME}/work/_/{VIRTUAL_HOST_NAME}/{SERVLET_CONTEXT}/
> 
> As was already pointed out, "deploying" and "installing" are different 
> operations and do different things, so if you clarify what you are doing 
> we might be able to help a little more.
> 
> Hope this is useful,
> Regards,
> Morgan
> 
> 
>>-----Original Message-----
>>From: Euan Guttridge [mailto:EGuttridge@buildonline.com] 
>>Sent: Wednesday, April 16, 2003 13:28
>>To: 'Tomcat Users List'
>>Subject: RE: Installs/deploys to... why?
>>
>>
>>In my (limited) experience of deploying with ant, the webapp 
>>gets deployed into the /work directory. Extract from Wrox 
>>"Professional Tomcat", p401:
>>
>>In reference to the ant deploy task:
>>--"Note that the WAR file did not get moved to the webapps 
>>directory. The WAR file in fact got copied to the 
>>$CATALINA_HOME/work/standalone/localhost/manager directory 
>>and then it was automatically expanded into the 
>>$CATALINA_HOME/work/standalone/localhost/wrox directory."--
>>
>>
>>
>>-----Original Message-----
>>From: Wendy Smoak [mailto:Wendy.Smoak@asu.edu] 
>>Sent: 16 April 2003 01:36
>>To: 'Tomcat Users List'
>>Subject: RE: Installs/deploys to... why?
>>
>>
>>Karsten wrote:
>>
>>>1. I'm using Ant to (deploy/)install my web app to a local 
>>>
>>Tomcat 4.1. 
>>
>>>Any time I do that, my web app gets installed in the context path 
>>>/basketball, which is right. The index.html is found, so 
>>>
>>the install 
>>
>>>seems to work. However, on the local server, when looking for the 
>>>files that have been installed, I don't get where the web 
>>>
>>application 
>>
>>>files actually are!
>>>
>>If you used 'install', the files are wherever you told ant 
>>they were, the files do not get moved.  Example:
>>
>><target name="install" depends="init" description="Install 
>>application to servlet container"> <install 
>>url="${manager.url}" username="${manager.username}" 
>>password="${manager.password}" path="/${context}" 
>>war="file://w:/java/bendev/webapp" /> 
>></target>
>>
>>And in w:/java/bendev/webapp is the normal directory 
>>structure you'd find for any webapp... some html files, a 
>>WEB-INF directory, etc.
>>
>>
>>>Anytime install or deploy succeeds, the directory called 
>>><tomcat-root>/work/Standalone/localhost/manager/basketball 
>>>
>>is created, 
>>
>>>however, *only* with the WEB-INF subdir recursively plus 
>>>
>>all the class 
>>
>>>files.
>>>
>>Mine (4.1.24) creates the same structure, but *only* the JSP 
>>source and .class files are there.  Look closely at the class 
>>names you find there, aren't they the JSP's and not your 
>>other .class files?
>>
>>I'm getting confused as to whether you're using 'install' or 
>>'deploy' and they are different, so I'll stop now before I 
>>get the rest of it wrong. ;)
>>
>>-- 
>>Wendy Smoak
>>Applications Systems Analyst, Sr.
>>Arizona State University PA Information Resources Management
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 



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


Re: Installs/deploys to work dir... why?

Posted by Jacob Kjome <ho...@visi.com>.
I'll paste the contents of my ccf.xml (context configuration file) 
below.  The web.xml has little to do with this functionality.  If you are 
looking for info on that, look at the spec, a book on servlets, or examples 
out there on the web.

Before Ant token filter copying...

<Context path="@context.path@" docBase="@context.docbase@"
          debug="5" reloadable="true" crossContext="true">

     <Logger
         className="org.apache.catalina.logger.FileLogger"
         prefix="localhost_@context.name@_servlet_log."
         suffix=".txt"
             timestamp="true" />

</Context>

After ant token filter copying...

<Context path="/Barracuda" 
docBase="D:\myclasses\Repository\Enhydra\BarracudaMVC_2003-04-16\Barracuda"
          debug="5" reloadable="true" crossContext="true">

     <Logger
         className="org.apache.catalina.logger.FileLogger"
         prefix="localhost_Barracuda_servlet_log."
         suffix=".txt"
             timestamp="true" />

</Context>

Also, I rename this as "context.xml" and add it to the META-INF directory 
of my .war file when I use the catalina ant "deploy" task.  This gets 
automatically used by Tomcat.  The file, very specifically, must be named 
"context.xml", though.


Also, as for your tomcat startup target, you might look into the following 
ant archive emails....

http://marc.theaimsgroup.com/?l=ant-dev&m=104327322209168&w=2
and
http://marc.theaimsgroup.com/?l=ant-user&m=104322316306620&w=2

I haven't tried either solution, but you should definitely try them 
out.  This woud provide your needed spawning of exec tasks functionality.

Jake



At 07:01 PM 4/16/2003 +0200, you wrote:


>Jacob Kjome wrote:
>
>>At 06:45 PM 4/16/2003 +0200, you wrote:
>>
>>>Answering your mail:
>>>
>>>I didn't write, the war file is put in the webapps dir... It's put into 
>>>the work/.../manager dir. Would you mind rereading my - admittedly long 
>>>- post? I'd really appreciate some more discussions on the install and 
>>>deploy tasks. Need more input...
>>>
>>>Thanks!
>>>Karsten
>>
>>Yep, you are right.  I definitely misread what you wrote.
>>What other input would you like?  Unfortunately, the current behavior of 
>>putting things in the work dir and serving directly from the .war file 
>>rather than expanding to a directory (as is the default in the webapps 
>>dir) is not something I can explain.  I really don't have a problem with 
>>the behavior so I haven't pursued the reasons behind it.  If you want to 
>>know more, you might try asking on the tomcat-dev list and ask the people 
>>who implemented the behavior themselves.
>>Jake
>
>Well, OK. That's where I will go next.
>
>Did you re/write the <catalina-install> and <catalina-deploy> task? What's 
>in a config file anyway?
>
>Would you mind sending me a copy of your config file? I have no idea how 
>one looks. Also, I'd appreciate, if you could send me your web.xml 
>deployment descriptor file... These are two issues for me I couldn't find 
>much info about.
>
>Is there anything you can add to the startup-local stuff?
>
>Thanks!
>Karsten
>
>PS: just paste my email add from the header
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org

Re: Installs/deploys to work dir... why?

Posted by Karsten Wutzke <kw...@web.de>.

Jacob Kjome wrote:

> At 06:45 PM 4/16/2003 +0200, you wrote:
> 
>> Answering your mail:
>>
>> I didn't write, the war file is put in the webapps dir... It's put 
>> into the work/.../manager dir. Would you mind rereading my - 
>> admittedly long - post? I'd really appreciate some more discussions on 
>> the install and deploy tasks. Need more input...
>>
>> Thanks!
>> Karsten
> 
> 
> Yep, you are right.  I definitely misread what you wrote.
> 
> What other input would you like?  Unfortunately, the current behavior of 
> putting things in the work dir and serving directly from the .war file 
> rather than expanding to a directory (as is the default in the webapps 
> dir) is not something I can explain.  I really don't have a problem with 
> the behavior so I haven't pursued the reasons behind it.  If you want to 
> know more, you might try asking on the tomcat-dev list and ask the 
> people who implemented the behavior themselves.
> 
> Jake

Well, OK. That's where I will go next.

Did you re/write the <catalina-install> and <catalina-deploy> task? 
What's in a config file anyway?

Would you mind sending me a copy of your config file? I have no idea how 
one looks. Also, I'd appreciate, if you could send me your web.xml 
deployment descriptor file... These are two issues for me I couldn't 
find much info about.

Is there anything you can add to the startup-local stuff?

Thanks!
Karsten

PS: just paste my email add from the header


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


Re: Installs/deploys to work dir... why?

Posted by Jacob Kjome <ho...@visi.com>.
At 06:45 PM 4/16/2003 +0200, you wrote:
>Answering your mail:
>
>I didn't write, the war file is put in the webapps dir... It's put into 
>the work/.../manager dir. Would you mind rereading my - admittedly long - 
>post? I'd really appreciate some more discussions on the install and 
>deploy tasks. Need more input...
>
>Thanks!
>Karsten

Yep, you are right.  I definitely misread what you wrote.

What other input would you like?  Unfortunately, the current behavior of 
putting things in the work dir and serving directly from the .war file 
rather than expanding to a directory (as is the default in the webapps dir) 
is not something I can explain.  I really don't have a problem with the 
behavior so I haven't pursued the reasons behind it.  If you want to know 
more, you might try asking on the tomcat-dev list and ask the people who 
implemented the behavior themselves.

Jake 

Re: Installs/deploys to work dir... why?

Posted by Karsten Wutzke <kw...@web.de>.
Here's my startup-local. If you think, I have a solution that works 
100%, I have to disappoint you. The task is the only one not working 
quite the way I'd like it to. It hangs when starting up the server, 
because Ant is not able to launch the server and continue. It launches 
the server and waits for the startup script to end, which won't since 
the server is running, and running, and running... or something like 
that. I have to press Ctrl-C to break this task. I can live with that as 
long as Ant doesn't support parallel exec tasks.

The code is below. I'm furthermore using the ant-contrib 
<if>-<then>-<else> tasks do do my checking. It's good for printing some 
diagnostic messages to the console. It's also easier for me to read, 
though I could have done some things with the <target>'s if/unless 
attributes.

In the code, I simply call <call-script-local>, once with the 
param=startup.sh and once with param=shutdown.sh. Before doing the 
actual call though, this target check whether the scripts dir and the sh 
scripts are there.

The <exec> task should be the one that runs in parallel to Ant though. 
Could be <spawn>. It's an unsolved issue with Ant.

   <!-- Call local Tomcat script interface (used by server 
startup/shutdown targets) -->
   <target name="call-script-local" description="Calls the local Tomcat 
script (with the set argument?).">
     <available property="local.scripts.dir" file="${local.script.dir}" 
type="dir"/>
     <if>
       <isset property="local.scripts.dir"/>
       <then>
         <echo message="Local Tomcat scripts dir '${local.script.dir}' 
found."/>
       </then>
       <else>
         <fail message="Local Tomcat scripts dir '${local.script.dir}' 
not found."/>
       </else>
     </if>
     <available property="local.script.startup" 
file="${local.startup.script}"/>
     <if>
       <isset property="local.script.startup"/>
       <then>
         <echo message="Local Tomcat start script file 
'${local.startup.script}' found in '${local.script.dir}'."/>
       </then>
       <else>
       <fail message="Local Tomcat start script file 
'${local.startup.script}' not found in '${local.script.dir}'."/>
       </else>
     </if>
     <available property="local.script.shutdown" 
file="${local.shutdown.script}"/>
     <if>
       <isset property="local.script.shutdown"/>
       <then>
         <echo message="Local Tomcat stop script file 
'${local.shutdown.script}' found in '${local.script.dir}'."/>
       </then>
       <else>
         <fail message="Local Tomcat stop script file 
'${local.shutdown.script}' not found in '${local.script.dir}'."/>
       </else>
     </if>
		<echo message="Issuing 'sh -c $CATALINA_HOME/bin/${local.script.arg} &amp;'"/>
     <exec executable="sh" failonerror="true">
     <arg line="-c '$CATALINA_HOME/bin/${local.script.arg} &amp;'"/>
     </exec>
   </target>



   <!-- Start up local Tomcat -->
   <target name="startup-local" depends="check-reach-local" 
description="Starts up local Tomcat.">
     <if>
       <isset property="local.unreachable"/>
       <then>
         <echo message="Local Tomcat not running! Starting up..."/>
         <antcall target="call-script-local">
           <param name="local.script.arg" value="startup.sh"/>
         </antcall>
         <echo message="Local Tomcat started up."/>
       </then>
       <else>
         <echo message="Local Tomcat already running! Won't start up 
again."/>
       </else>
     </if>
   </target>


   <!-- Shutdown local Tomcat -->
   <target name="shutdown-local" depends="check-reach-local" 
description="Shuts down local Tomcat.">
     <if>
       <isset property="local.unreachable"/>
       <then>
         <echo message="Local Tomcat already shut down! Won't shut down 
again."/>
       </then>
       <else>
         <echo message="Local Tomcat running! Shutting down..."/>
         <antcall target="call-script-local">
           <param name="local.script.arg" value="shutdown.sh"/>
         </antcall>
         <echo message="Local Tomcat shut down."/>
       </else>
     </if>
   </target>


Answering your mail:

I didn't write, the war file is put in the webapps dir... It's put into 
the work/.../manager dir. Would you mind rereading my - admittedly long 
- post? I'd really appreciate some more discussions on the install and 
deploy tasks. Need more input...

Thanks!
Karsten

Jacob Kjome wrote:

> 
> I'm a bit mystified why you have basketball.war in CATALINA_HOME/webapps 
> because neither ant task copies it there.  You must have put it there 
> yourself.  Stop Tomcat, remove it from webapps, and it shouldn't appear 
> there again.
> 
> As for the install/deploy tasks, here are mine...
> 
>     <target name="catalina-install" depends="compile,manager.init"
>             description="Install application to servlet container" >
>         <catalina-install
>             url="${manager.url}"
>             username="${manager.username}"
>             password="${manager.password}"
>             config="${app.ccf}"
>             path="${app.path}" />
>     </target>
> 
>     <target name="catalina-deploy" depends="war,manager.init"
>             description="Deploy web-app war" >
>         <echo message="${app.war}"/>
>         <catalina-deploy
>             url="${manager.url}"
>             username="${manager.username}"
>             password="${manager.password}"
>             path="${app.path}"
>             war="${app.war}" />
>     </target>
> 
> Notice that I use a context configuration file, or CCF ( ${app.ccf} ), 
> in the install task.  The <Context> docBase attribute in the CCF points 
> to the local directory where my build exists.  So, the app is "deployed" 
> from wherever it exist on the file system and not from a .war file and 
> it isn't copied anywhere like the webapps directory.
> 
> The "deploy" task includes a context configuration file in the .war file 
> in META-INF/context.xml to describe the app.  I use the deploy task 
> *only* for permanent installs of my application that I need to exist 
> across server restarts.  And this war file does *not* end up in the 
> webapps directory.  Only in the work directory for the manager app.
> 
> Hope that helps.
> 
> BTW, would you mind posting your "startup-local" target?
> 
> thanks,
> 
> Jake
> 
> At 05:19 PM 4/16/2003 +0200, you wrote:
> 
>> It's really nothing special. Currently, I'm starting to develop a 
>> JSP/Servlet web app which connects to a MySQL 4 DB to retrieve 
>> Basketball statistics of players, games, teams etc. I started with Ant 
>> to create an automation framework. I'm working on my localhost right 
>> now, but I want to do the things in a way, so that I can use as much 
>> of the XML code as possible for bringing the whole thing over to a 
>> remote server...
>>
>> For now, I have created two Ant targets, <install-local> and 
>> <deploy-local> doing the *exactly* the same. I did this just to find 
>> out which task does what I expect. In the end, both tasks successfully 
>> get the web app up and running, but in Tomcat directories I did *not* 
>> expect.
>>
>> Here's some code, nothing special (local means Tomcat on the localhost):
>>
>> <property name="local.manager.url" 
>> value="http://localhost:8080/manager"/>
>> <property name="local.manager.username" value="anything"/>
>> <property name="local.manager.password" value="anything"/>
>> <property name="local.context.path" value="/basketball"/>
>> <property name="dist.file" location="dist/basketball.war"/>
>>
>> <target name="deploy-local" depends="dist,startup-local">
>>   <deploy url="${local.manager.url}"
>>           username="${local.manager.username}"
>>           password="${local.manager.password}"
>>           path="${webapp.context.path}"
>>           war="file://${dist.file}"/>
>> </target>
>>
>> <target name="install-local" depends="dist,startup-local">
>>   <install url="${local.manager.url}"
>>            username="${local.manager.username}"
>>            password="${local.manager.password}"
>>            path="${webapp.context.path}"
>>            war="file://${dist.file}"/>
>> </target>
>>
>> As you can see, the two targets are exactly the same, they just use 
>> the deploy and install Ant tasks. The dist.file property is the war 
>> file the "dist" depends task put into the development dist directory 
>> before. From there the web app war is installed/deployed. The 
>> <startup-local> tasks ensures local Tomcat is running (to be able to 
>> use the Manager app).
>>
>> To me the whole difference between the <install> and <deploy> is tasks 
>> is unclear - please enlighten me...
>>
>> The only differences I can see are:
>>
>> - the deploy task also copies the war file to the 
>> $CATALINA_HOME/work/standalone/localhost/manager directory and locks 
>> the file, so I can't delete it (e.g. with my Explorer)
>> - when using deploy, the web app is permanently remembered between 
>> server restarts
>>
>> I find it pretty strange, not to find the web app war in the webapps 
>> dir, and the basketball dir, too. Is there anything that might be 
>> misconfigured? Though I did not edit any files or anything besides 
>> adding a user/pw combo with the manager role.
>>
>> Should I simply accept it the way it is? What is going on behind the 
>> scenes? Are the Ant tasks responsible for this or Tomcat?
>>
>> Karsten
>>
>> Morgan Pyne wrote:
>>
>>> When we use Ant to "deploy" via the manager, the WAR file gets 
>>> uploaded to:
>>> {TOMCAT_HOME}/work/_/{VIRTUAL_HOST_NAME}/tomcat4_manager/
>>> By default, our Tomcat is set not to expand war files, so only the 
>>> actual WAR archive gets put in there.
>>> Once we actually access the servlet, the files are extracted into:
>>> {TOMCAT_HOME}/work/_/{VIRTUAL_HOST_NAME}/{SERVLET_CONTEXT}/
>>> As was already pointed out, "deploying" and "installing" are 
>>> different operations and do different things, so if you clarify what 
>>> you are doing we might be able to help a little more.
>>> Hope this is useful,
>>> Regards,
>>> Morgan
>>>
>>>> -----Original Message-----
>>>> From: Euan Guttridge [mailto:EGuttridge@buildonline.com] Sent: 
>>>> Wednesday, April 16, 2003 13:28
>>>> To: 'Tomcat Users List'
>>>> Subject: RE: Installs/deploys to... why?
>>>>
>>>>
>>>> In my (limited) experience of deploying with ant, the webapp gets 
>>>> deployed into the /work directory. Extract from Wrox "Professional 
>>>> Tomcat", p401:
>>>>
>>>> In reference to the ant deploy task:
>>>> --"Note that the WAR file did not get moved to the webapps 
>>>> directory. The WAR file in fact got copied to the 
>>>> $CATALINA_HOME/work/standalone/localhost/manager directory and then 
>>>> it was automatically expanded into the 
>>>> $CATALINA_HOME/work/standalone/localhost/wrox directory."--
>>>>
>>>>
>>>>
>>>> -----Original Message-----
>>>> From: Wendy Smoak [mailto:Wendy.Smoak@asu.edu] Sent: 16 April 2003 
>>>> 01:36
>>>> To: 'Tomcat Users List'
>>>> Subject: RE: Installs/deploys to... why?
>>>>
>>>>
>>>> Karsten wrote:
>>>>
>>>>> 1. I'm using Ant to (deploy/)install my web app to a local
>>>>
>>>> Tomcat 4.1.
>>>>
>>>>> Any time I do that, my web app gets installed in the context path 
>>>>> /basketball, which is right. The index.html is found, so
>>>>
>>>> the install
>>>>
>>>>> seems to work. However, on the local server, when looking for the 
>>>>> files that have been installed, I don't get where the web
>>>>
>>>> application
>>>>
>>>>> files actually are!
>>>>
>>>> If you used 'install', the files are wherever you told ant they 
>>>> were, the files do not get moved.  Example:
>>>>
>>>> <target name="install" depends="init" description="Install 
>>>> application to servlet container"> <install url="${manager.url}" 
>>>> username="${manager.username}" password="${manager.password}" 
>>>> path="/${context}" war="file://w:/java/bendev/webapp" /> </target>
>>>>
>>>> And in w:/java/bendev/webapp is the normal directory structure you'd 
>>>> find for any webapp... some html files, a WEB-INF directory, etc.
>>>>
>>>>
>>>>> Anytime install or deploy succeeds, the directory called 
>>>>> <tomcat-root>/work/Standalone/localhost/manager/basketball
>>>>
>>>> is created,
>>>>
>>>>> however, *only* with the WEB-INF subdir recursively plus
>>>>
>>>> all the class
>>>>
>>>>> files.
>>>>
>>>> Mine (4.1.24) creates the same structure, but *only* the JSP source 
>>>> and .class files are there.  Look closely at the class names you 
>>>> find there, aren't they the JSP's and not your other .class files?
>>>>
>>>> I'm getting confused as to whether you're using 'install' or 
>>>> 'deploy' and they are different, so I'll stop now before I get the 
>>>> rest of it wrong. ;)
>>>>
>>>> -- Wendy Smoak
>>>> Applications Systems Analyst, Sr.
>>>> Arizona State University PA Information Resources Management
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>>>
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 



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


Re: Installs/deploys to work dir... why?

Posted by Jacob Kjome <ho...@visi.com>.
I'm a bit mystified why you have basketball.war in CATALINA_HOME/webapps 
because neither ant task copies it there.  You must have put it there 
yourself.  Stop Tomcat, remove it from webapps, and it shouldn't appear 
there again.

As for the install/deploy tasks, here are mine...

     <target name="catalina-install" depends="compile,manager.init"
             description="Install application to servlet container" >
         <catalina-install
             url="${manager.url}"
             username="${manager.username}"
             password="${manager.password}"
             config="${app.ccf}"
             path="${app.path}" />
     </target>

     <target name="catalina-deploy" depends="war,manager.init"
             description="Deploy web-app war" >
         <echo message="${app.war}"/>
         <catalina-deploy
             url="${manager.url}"
             username="${manager.username}"
             password="${manager.password}"
             path="${app.path}"
             war="${app.war}" />
     </target>

Notice that I use a context configuration file, or CCF ( ${app.ccf} ), in 
the install task.  The <Context> docBase attribute in the CCF points to the 
local directory where my build exists.  So, the app is "deployed" from 
wherever it exist on the file system and not from a .war file and it isn't 
copied anywhere like the webapps directory.

The "deploy" task includes a context configuration file in the .war file in 
META-INF/context.xml to describe the app.  I use the deploy task *only* for 
permanent installs of my application that I need to exist across server 
restarts.  And this war file does *not* end up in the webapps 
directory.  Only in the work directory for the manager app.

Hope that helps.

BTW, would you mind posting your "startup-local" target?

thanks,

Jake

At 05:19 PM 4/16/2003 +0200, you wrote:
>It's really nothing special. Currently, I'm starting to develop a 
>JSP/Servlet web app which connects to a MySQL 4 DB to retrieve Basketball 
>statistics of players, games, teams etc. I started with Ant to create an 
>automation framework. I'm working on my localhost right now, but I want to 
>do the things in a way, so that I can use as much of the XML code as 
>possible for bringing the whole thing over to a remote server...
>
>For now, I have created two Ant targets, <install-local> and 
><deploy-local> doing the *exactly* the same. I did this just to find out 
>which task does what I expect. In the end, both tasks successfully get the 
>web app up and running, but in Tomcat directories I did *not* expect.
>
>Here's some code, nothing special (local means Tomcat on the localhost):
>
><property name="local.manager.url" value="http://localhost:8080/manager"/>
><property name="local.manager.username" value="anything"/>
><property name="local.manager.password" value="anything"/>
><property name="local.context.path" value="/basketball"/>
><property name="dist.file" location="dist/basketball.war"/>
>
><target name="deploy-local" depends="dist,startup-local">
>   <deploy url="${local.manager.url}"
>           username="${local.manager.username}"
>           password="${local.manager.password}"
>           path="${webapp.context.path}"
>           war="file://${dist.file}"/>
></target>
>
><target name="install-local" depends="dist,startup-local">
>   <install url="${local.manager.url}"
>            username="${local.manager.username}"
>            password="${local.manager.password}"
>            path="${webapp.context.path}"
>            war="file://${dist.file}"/>
></target>
>
>As you can see, the two targets are exactly the same, they just use the 
>deploy and install Ant tasks. The dist.file property is the war file the 
>"dist" depends task put into the development dist directory before. From 
>there the web app war is installed/deployed. The <startup-local> tasks 
>ensures local Tomcat is running (to be able to use the Manager app).
>
>To me the whole difference between the <install> and <deploy> is tasks is 
>unclear - please enlighten me...
>
>The only differences I can see are:
>
>- the deploy task also copies the war file to the 
>$CATALINA_HOME/work/standalone/localhost/manager directory and locks the 
>file, so I can't delete it (e.g. with my Explorer)
>- when using deploy, the web app is permanently remembered between server 
>restarts
>
>I find it pretty strange, not to find the web app war in the webapps dir, 
>and the basketball dir, too. Is there anything that might be 
>misconfigured? Though I did not edit any files or anything besides adding 
>a user/pw combo with the manager role.
>
>Should I simply accept it the way it is? What is going on behind the 
>scenes? Are the Ant tasks responsible for this or Tomcat?
>
>Karsten
>
>Morgan Pyne wrote:
>
>>When we use Ant to "deploy" via the manager, the WAR file gets uploaded to:
>>{TOMCAT_HOME}/work/_/{VIRTUAL_HOST_NAME}/tomcat4_manager/
>>By default, our Tomcat is set not to expand war files, so only the actual 
>>WAR archive gets put in there.
>>Once we actually access the servlet, the files are extracted into:
>>{TOMCAT_HOME}/work/_/{VIRTUAL_HOST_NAME}/{SERVLET_CONTEXT}/
>>As was already pointed out, "deploying" and "installing" are different 
>>operations and do different things, so if you clarify what you are doing 
>>we might be able to help a little more.
>>Hope this is useful,
>>Regards,
>>Morgan
>>
>>>-----Original Message-----
>>>From: Euan Guttridge [mailto:EGuttridge@buildonline.com] Sent: 
>>>Wednesday, April 16, 2003 13:28
>>>To: 'Tomcat Users List'
>>>Subject: RE: Installs/deploys to... why?
>>>
>>>
>>>In my (limited) experience of deploying with ant, the webapp gets 
>>>deployed into the /work directory. Extract from Wrox "Professional 
>>>Tomcat", p401:
>>>
>>>In reference to the ant deploy task:
>>>--"Note that the WAR file did not get moved to the webapps directory. 
>>>The WAR file in fact got copied to the 
>>>$CATALINA_HOME/work/standalone/localhost/manager directory and then it 
>>>was automatically expanded into the 
>>>$CATALINA_HOME/work/standalone/localhost/wrox directory."--
>>>
>>>
>>>
>>>-----Original Message-----
>>>From: Wendy Smoak [mailto:Wendy.Smoak@asu.edu] Sent: 16 April 2003 01:36
>>>To: 'Tomcat Users List'
>>>Subject: RE: Installs/deploys to... why?
>>>
>>>
>>>Karsten wrote:
>>>
>>>>1. I'm using Ant to (deploy/)install my web app to a local
>>>Tomcat 4.1.
>>>>Any time I do that, my web app gets installed in the context path 
>>>>/basketball, which is right. The index.html is found, so
>>>the install
>>>>seems to work. However, on the local server, when looking for the files 
>>>>that have been installed, I don't get where the web
>>>application
>>>>files actually are!
>>>If you used 'install', the files are wherever you told ant they were, 
>>>the files do not get moved.  Example:
>>>
>>><target name="install" depends="init" description="Install application 
>>>to servlet container"> <install url="${manager.url}" 
>>>username="${manager.username}" password="${manager.password}" 
>>>path="/${context}" war="file://w:/java/bendev/webapp" /> </target>
>>>
>>>And in w:/java/bendev/webapp is the normal directory structure you'd 
>>>find for any webapp... some html files, a WEB-INF directory, etc.
>>>
>>>
>>>>Anytime install or deploy succeeds, the directory called 
>>>><tomcat-root>/work/Standalone/localhost/manager/basketball
>>>is created,
>>>>however, *only* with the WEB-INF subdir recursively plus
>>>all the class
>>>>files.
>>>Mine (4.1.24) creates the same structure, but *only* the JSP source and 
>>>.class files are there.  Look closely at the class names you find there, 
>>>aren't they the JSP's and not your other .class files?
>>>
>>>I'm getting confused as to whether you're using 'install' or 'deploy' 
>>>and they are different, so I'll stop now before I get the rest of it wrong. ;)
>>>
>>>-- Wendy Smoak
>>>Applications Systems Analyst, Sr.
>>>Arizona State University PA Information Resources Management
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>>
>>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org