You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Nilesh Bhattad <ni...@outlinesys.com> on 2004/12/01 01:03:47 UTC

Problems with deployment process using Eclipse + Ant + Tomcat

Googled, serached thro tomcat FAQs, tried as much as I could and now I'm posting some qns --

Environment: Eclipse 3.0.0 + MyEclipse + Tomcat 5.5.0 (on a different server)

I'm not able to setup a smooth deployment process from my eclipse workspace over to Tomcat server which is located on a different machine. I have attached build.xml, build.properties, tomcatTasks.properties for your reference. Also attached is the build.log when I run 'deploy'

Ok. Now here are my specific questions/problems -

1) For the first time the script ran fine and uploaded the WAR file over to Tomcat server. Even though I got 'OK' message back, it didn't really deploy the application. I had to manually stop and start tomcat server and then it automatically recognized the new WAR file and deployed it. Is there any setting in Tomcat which will 'deploy' the application as soon as a WAR is put/changed underneath $CATALINA_HOME/webapps directory? If not, is there any ANT task provided which will stop and start the tomcat server? I went thro 'start' and 'stop' ant tasks but they are applicable to individual web applications and not to the server. Please correct me if I'm wrong.

2) 'undeploy' task runs fine and removes the app context from the server. However, it does not delete the WAR and extracted application directory from $CATALINA_HOME/webapps. I guess that is a right behavior. But that causes me a problem when I redeploy the application. 'deploy' ant job gives the below error. 

[echo] Deploying file:C:\Program Files\eclipse\workspace\PowerRAD/build/PowerRAD.war for PowerRAD.
   [deploy] Cannot find message associated with key managerServlet.deployFailed
BUILD FAILED: C:\Program Files\eclipse\workspace\PowerRAD\build.xml:72: The following error occurred while executing this line:
C:\Program Files\eclipse\workspace\PowerRAD\build.xml:171: Cannot find message associated with key managerServlet.deployFailed
Total time: 52 seconds

If I remove the WAR file reference and the extracted directory from tomcat server, then the deploy script runs fine.(at least uploads the WAR over to Tomcat) 'managerServlet.deployFailed' is a very generic message and it doesn't give me a clue of what could be going wrong. Yes, I checked the username, password and server URL and they all seem to be fine!! Am I missing something in build.xml?

3) catalina-ant.jar already has catalina.tasks file in it. Is there a way to use that properties file instead of writing our own(tomcatTasks.properties)? I'm trying to avoid copying catalina-ant.jar inside $ANT_HOME\lib directory. This will add up an extra step when setting up the project on a different machine.

Any help is highly appreciated.

Thanks.

Re: Problems with deployment process using Eclipse + Ant + Tomcat

Posted by Paul Christmann <pa...@priorartisans.com>.
We use ant build scripts (launched from eclipse, anthill, command 
prompts, just about anywhere) to deploy webapps to Tomcat and it works 
fine for us.  But we did have difficulties when we started doing so.  We 
are currently using Tomcat 5.0.28; we've done it for a long time on 
Tomcat 4.1; we've tested it on Tomcat 5.5, but I can't say that it 
worked - we had other issues (unrelated to ant or Tomcat) that got in 
the way.

Its been a while since I went through these problems, but here's my 
recollections:

a) There are several tasks in the catalina-ant.jar.  In particular, 
though, there are two different sets of tasks that can be used for 
deploying webapps: <install>/<remove> and <deploy>/<undeploy>.  You 
cannot <remove> a <deploy>'d app nor can you <undeploy> an <install>'d 
app.

I don't fully recall the difference between those sets of tasks, but we 
discovered that the <deploy>/<undeploy> tasks worked better for us.

b) We change the unpackWars attribute in the <Host> element of the 
server.xml from true (its default value on a Windows installation) to 
false.

Without this change, Tomcat unpacked the deployed webapp, which caused 
difficultied with the removal (files weren't removed) which then 
prevented redeployment.

c) Side note about your ant scripts:  your "deploy" target uses a bunch
of ant calls to do different things (build, war, tomcat_deploy and
email).  In each case you are passing inheritrefs=true and
inheritall=true and calling targets in the same build file.  You'd
probably be better off just doing this as dependencies instead:

   <target name="deploy" depends="init, build, war, deploy_tomcat, email"/>

I hope that helps,

-- 
PC

Paul Christmann
Prior Artisans, LLC
mailto:paul@priorartisans.com
504-587-9072


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