File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes UnDeploy task is not working properly Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "UnDeploy task is not working properly" Watch "UnDeploy task is not working properly" New topic

UnDeploy task is not working properly

Srinivas Ivaturi
Ranch Hand

Joined: Jan 28, 2003
Posts: 50
I have a build.xml which will undeploy my existing web context and re-deploy it again. The build.xml is as below. But my requirement is I will send the condition from command line.

<!-- Tomcat Ant Tasks -->
<!--<project name="webmodulebuilder" default="remove" basedir=".">-->
<project name="webmodulebuilder" default="all" basedir=".">
<taskdef file="D:/AntExample/TomcatAnt/">
<pathelement path="C:\Program Files\Apache Software Foundation\Tomcat 5.0\server\lib\catalina-ant.jar"/>

<target name="install" description="Install application in Tomcat" >
<deploy url="http://localhost:8080/manager/html"

<target name="check-cond">
<condition property="cond-is-true">
<equals arg1="Yes" arg2="${x}" />

<target name="uninstall" description="Remove application from Tomcat" depends="check-cond" if="cond-is-true">
<undeploy url="http://localhost:8080/manager/html"

<target name="all" depends="uninstall, install" />

After execution of uninstall target it is saying BUILD FAILED. And not installing the new web module again. Can somebody look into the script and tell me if I am doing any mistake.

It is generating HTML dump like below . There is more HTML dump so I am pasting some part.

D:\AntExample\TomcatAnt>ant -Dx=Yes
Buildfile: build.xml


[undeploy] <html>
[undeploy] <head>
[undeploy] <style>
[undeploy] H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,A
rial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;backgrou
nd-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Ta
homa,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;f
ont-size:12px;}A {color : black;} {color : black;}HR {color : #525D76;} table {
[undeploy] width: 100%;
[undeploy] }
[undeploy] {
[undeploy] text-align: center;
[undeploy] vertical-align: top;
[undeploy] font-family:sans-serif,Tahoma,Arial;
[undeploy] font-weight: bold;
[undeploy] background: white;
[undeploy] color: black;
[undeploy] }
[undeploy] td.title {
[undeploy] text-align: left;
[undeploy] vertical-align: top;
[undeploy] <hr size="1" noshade="noshade">
[undeploy] <center><font size="-1" color="#525D76">
[undeploy] <em>Copyright © 1999-2003, Apache Software Foundation</em></font></center>

[undeploy] </body>
[undeploy] </html>


Thanks in advance
Srinivas Ivaturi.
Ray Stojonic
Ranch Hand

Joined: Aug 08, 2003
Posts: 326
undeploy is looking for the manager url, not the manager/html url.
deploy is going to fail when you get that far because file: should refer to an expanded web-app, use jar: to refer to a war.

How to use Tomcat Ant tasks
[ June 10, 2005: Message edited by: Ray Stojonic ]
I agree. Here's the link:
subject: UnDeploy task is not working properly
jQuery in Action, 3rd edition