tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emerson Cargnin <emer...@tre-sc.gov.br>
Subject Re: deploying webapps from ant
Date Wed, 28 Apr 2004 18:15:24 GMT
I use the following targets to check if the app is already deployed, in 
which case it's undeployed before deployment

I had some problems before tomcat 5 when using struts app's, due of a 
lock of struts.jar (happened just in windows env).

Of course you should set some properties beforehand, as name (app 
context), host (host to deploy to)...


<target name="prepareDeployTomCat"
    	 		    depends="web-war">



	  <property name="tomcat.server"      value="http://${host}:8080"/>	
	  <property name="path"     value="/${name}"/>
	
	  <!-- Configure properties to access the Manager application -->
   	  <property  name="url.app"  value="${tomcat.server}${path}"/>
	  <property name="url"      value="${tomcat.server}/manager"/>
	  <property name="username" value="tomcat"/>
	  <property name="password" value="tomcat"/>
	
  	  <!-- Configure the custom Ant tasks for the Manager application -->
	  <taskdef name="deploy" 
classname="org.apache.catalina.ant.DeployTask"/>
	  <taskdef name="undeploy" 
classname="org.apache.catalina.ant.UndeployTask"/>

	
	  <condition property="app.on">
		<http url="${url.app}"/>
   	  </condition>

   </target>

	<target name="undeployTomCat" depends="prepareDeployTomCat" if="app.on">
		<undeploy url="${url}" username="${username}" password="${password}" 
path="${path}" />
	  <echo message="undeploy ok"/>
	</target>




    <target name="deployTomCat" 
depends="prepareDeployTomCat,undeployTomCat">
	 	
	  <deploy url="${url}" username="${username}" password="${password}" 
path="${path}" war="file:///${web.war.file}"/>
		<echo message="deploy ok"/>
	</target>



Jacob Kjome wrote:
> At 10:15 AM 4/28/2004 +0530, you wrote:
> 
>> I don't get any exception along with this message. I haven't started any
>> threads. All I did was deploy the application, then try to deploy it.
> 
> 
> At this point, I have no more suggestions unless you post your Ant 
> script.  All I can say is that it never fails for me.
> 
> 
> Jake
> 
>> ----- Original Message -----
>> From: "Jacob Kjome" <hoju@visi.com>
>> To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
>> Sent: Tuesday, April 27, 2004 6:55 PM
>> Subject: Re: deploying webapps from ant
>>
>>
>> > At 02:38 PM 4/27/2004 +0530, you wrote:
>> > >I changed it to use DeployTask and UndeployTask instead of InstallTask
>> and
>> > >RemoveTask. After I deploy a task, I try to undeploy it and get the
>> > >following error message:
>> > >
>> > >Cannot remove document base for path /myapp
>> >
>> > Do you get any exception along with this message?  Have you shut 
>> down all
>> > threads that you started?  Tomcat can't remove resources that are still
>> > being referenced.  Shut everything down in a servlet context 
>> listener.  If
>> > you use Log4j, do a LogManager.shutdown() there.
>> >
>> >
>> > Jake
>> >
>> >
>> >
>> > >----- Original Message -----
>> > >From: "Jacob Kjome" <hoju@visi.com>
>> > >To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
>> > >Sent: Saturday, April 24, 2004 9:06 PM
>> > >Subject: Re: deploying webapps from ant
>> > >
>> > >
>> > > >
>> > > > Are you sure you deploying your app to the webapps directory?  
>> Did you
>> do
>> > > > an "install" or a "deploy"?  In Tomcat5, "install" has been 
>> deprecated
>> and
>> > > > "deploy" should be used with the "localWar" attribute if you 
>> mean to
>> > >deploy
>> > > > it to a local directory.  In both cases, "deploy" without 
>> "localWar"
>> will
>> > > > upload the war to the server and stick it either in "webapps"
>> (Tomcat5) or
>> > > > in the work directory (Tomcat4.1).  In both these cases, an 
>> "undeploy"
>> > > > should be used, not "remove".  "install" and "remove" were meant to
>> deploy
>> > > > an app to a local directory that Tomcat would not delete upon the
>> > > > "remove".  Make sure to match up usage of deploy/undeploy and
>> > > > install/remove.  Mixing these will give you unexpected results.
>> > > >
>> > > >
>> > > > Jake
>> > > >
>> > > > At 02:24 PM 4/24/2004 +0530, you wrote:
>> > > > >I am trying to deploy my webapps from ant, however my undeploy

>> task
>> does
>> > > > >not always work. It quietly informs me that everything is ok,

>> however
>> the
>> > > > >webapps subdirectory still exists, with at least some of the files
>> still
>> > > > >there. Tomcat appears to be holding onto locks on the files and

>> they
>> > > > >cannot be deleted. This is with both Tomcat 4 and Tomcat 5, 
>> running
>> on
>> > > > >Windows XP. Here is my ant code showing my undeploy task:
>> > > > >
>> > > > >    <target name="webapp.check">
>> > > > >        <fail unless="tomcat.url"
>> > > > >              message="tomcat.url is not specified in
>> local.properties
>> > > > > file."/>
>> > > > >        <fail unless="tomcat.manager.url"
>> > > > >              message="tomcat.manager.url is not specified in
>> > > > > local.properties file."/>
>> > > > >        <fail unless="tomcat.manager.username"
>> > > > >              message="tomcat.manager.username is not specified
in
>> > > > > local.properties file."/>
>> > > > >        <fail unless="tomcat.manager.password"
>> > > > >              message="tomcat.manager.password is not specified
in
>> > > > > local.properties file."/>
>> > > > >        <condition property="tomcat.is.started">
>> > > > >            <http url="${tomcat.url}"/>
>> > > > >        </condition>
>> > > > >        <condition property="webapp.is.deployed">
>> > > > >            <and>
>> > > > >                <isset property="tomcat.is.started"/>
>> > > > >                <http url="${tomcat.url}/${ant.project.name}"/>
>> > > > >            </and>
>> > > > >        </condition>
>> > > > >    </target>
>> > > > >
>> > > > >    <target name="undeploy" depends="webapp.check"
>> > >if="webapp.is.deployed">
>> > > > >        <taskdef name="remove"
>> > >classname="org.apache.catalina.ant.RemoveTask">
>> > > > >            <classpath>
>> > > > >                <path
>> > >location="${tomcatHome}/server/lib/catalina-ant.jar"/>
>> > > > >            </classpath>
>> > > > >        </taskdef>
>> > > > >        <remove url="${tomcat.manager.url}"
>> > > > >                 username="${tomcat.manager.username}"
>> > > > >                 password="${tomcat.manager.password}"
>> > > > >                 path="/${ant.project.name}"/>
>> > > > >    </target>
>> > > > >
>> > > > >
>> > > > 
>> >---------------------------------------------------------------------
>> > > > >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
>> >
>>
>>
>> ---------------------------------------------------------------------
>> 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
> 
> 


-- 
Emerson Cargnin
Analista de Sistemas
Setor de Desenvolvimento de Sistemas - TRE-SC
tel : (048) - 251-3700 - Ramal 3181

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


Mime
View raw message