This week's book / license giveaways are in the JDBC and Relational Databases and Java in General forums.
We're giving away four copies each of PostGIS in Action and Java Advanced Topics Training and have the authors on-line!
See this thread and this one for details.
The moose likes Tomcat and the fly likes Redeploy application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » Tomcat
Bookmark "Redeploy application" Watch "Redeploy application" New topic
Author

Redeploy application

Imre Tokai
Ranch Hand

Joined: Jun 04, 2008
Posts: 130
Hello,


Whenever i want to deploy new version of application (that's VERY often), have to:
stop tomcat;
execute build.xml -ant script;
start tomcat;

Is there any way, target in ant, that can make this easier?


Regards





Kees Jan Koster
JavaMonitor Support
Rancher

Joined: Mar 31, 2009
Posts: 251
    
    5
Dear Imre,

How about this: don't restart Tomcat, but copy the war into the webapps directory. Tomcat will hot-deploy the app, saving precious seconds.

Also: check your webapp startup sequence and reduce the amount of startup work. Tomcat starts in a second or two on my laptop, so you're not waiting for Tomcat to start, but for your own webapp. :-)


Java-monitor, JVM monitoring made easy <- right here on Java Ranch
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 62488
    
  68

The Tomcat Manager application can start and stop individual applications without the need to start and stop Tomcat.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Imre Tokai
Ranch Hand

Joined: Jun 04, 2008
Posts: 130
That is what i need, but when:


1.) Only overwrite appname.war or erase appname.war and copy new appname.war on {tomcat.home}/webapps
Undeploying context [/appname]
Deploying web application archive appname.war

and when i want to access to webapp via browser i get
http status 404 requested source is not available



2.) Want to erase {tomcat.home}/webapps/appname folder and {tomcat.home}/webapps/appname.war

build.xml:63: Unable to delete file D:\apache-tomcat-5.5.26\webapps\tracking\WEB-INF\lib\formdef_1_0-validator_1_2_0.jar

When i copy necessary jars to {tomcat.home}/common/lib or {tomcat.home}/server/lib and remove them from my webapp, i get error ClassLoaderError...

I'm developing a Struts framework based application.


How to solve this? Any similar experience?


Regards
Misha Ver
Ranch Hand

Joined: Mar 03, 2008
Posts: 470
Look at http://tomcat.apache.org/tomcat-5.5-doc/manager-howto.html#Executing%20Manager%20Commands%20With%20Ant
Imre Tokai
Ranch Hand

Joined: Jun 04, 2008
Posts: 130
Thank you for your answer, Misha!


BUT i get:
BUILD FAILED
E:\AppName\build.xml:87: Problem: failed to create task or type deploy
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.



Any more hints?


Best Regards
Misha Ver
Ranch Hand

Joined: Mar 03, 2008
Posts: 470
Most likely you are missing catalina-ant.jar
Imre Tokai
Ranch Hand

Joined: Jun 04, 2008
Posts: 130
I added this to META-INF/context.xml:

<Context reloadable="true" antiResourceLocking="true">
( former: <Context> )

just overwrite webapps/appname.war and it seems to work!


Any experiences with this approach?


Regards
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Redeploy application