File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes How does Tomcat 6 know to automatically redeploy an application? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "How does Tomcat 6 know to automatically redeploy an application?" Watch "How does Tomcat 6 know to automatically redeploy an application?" New topic
Author

How does Tomcat 6 know to automatically redeploy an application?

patrick flaherty
Greenhorn

Joined: Jan 13, 2011
Posts: 4
I shut Tomcat down and then thought I could remove an application by simply deleting its directory under the webapps directory.

However when I restarted Tomcat it automatically redeployed (installed) the application.

The application build is on the same machine and under my d:\"eclipse workspace" directory (this is Windows 7). I grepped the whole of the tomcat installation to see if I could find this value anyway (that is, where Tomcat would find the files to redeploy) but didn't come up with anything.

How does Tomcat know where and how to find and redeploy an application? Is there a file that represents the central repository for a Tomcat installation for what applications it should find? I looked through the files in the %TOMCAT_HOME%\conf and didn't find what I was looking for there either.

thanks - pat
patrick flaherty
Greenhorn

Joined: Jan 13, 2011
Posts: 4
Perhaps I was wrong and Tomcat doesn't have a central listing of applications - perhaps it just bases itself off of what it finds in webapps.

I removed my application again by simply deleting the its directory and contents from the file system. When I reran Tomcat it did not redeploy.

So I deployed it from using http://localhost:8080/manager/html using the Tomcat application root directory name and the project's WAR file from its build location under Eclipse and that worked.

Anyone know how to deploy to Tomcat 6 from Eclipse 3.6? Its an Eclipse maven project using m2e. I've looked around inside Eclipse and have yet to figure out how to successfully use Eclipse to deploy. 'Build', 'package', etc: yes. But the maven install puts the both the WAR and extracted WAR into a local Eclipse directory. There must be some way of telling Eclipse where the Tomcat install directory is.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15950
    
  19

Nope. Tomcat doesn't have a central registry of webapps. What it does is scan the webapp contexts when it starts up. And, by default, periodically thereafter. The contexts that are scanned are as follows:

1. The TOMCAT_HOME/webapps directory. If an exploded WAR is found, Tomcat attempts to deploy it. If an unexploded WAR is found AND there is no corresponding exploded WAR, Tomcat will explode it and deploy it (assuming default server config).

2. The webapp context directory. This is typically TOMCAT_HOME/conf/catalina/localhost. Contexts found there will be deployed.

3. The Tomcat server.xml file. However, this is no longer a recommended place to put webapp Context definitions and hasn't been for a long, long time.

I have probably missed a place or 2. And, in case anyone's wondering, "TOMCAT_HOME" is the cop-out shorthand I use when referring to the Tomcat server's root directory and am too lazy to lookup whether it should be the CATALINA_HOME location or the CATALINA_BASE location, since usually they're the same place.


Customer surveys are for companies who didn't pay proper attention to begin with.
patrick flaherty
Greenhorn

Joined: Jan 13, 2011
Posts: 4
thanks Tim - that's helpful.

I now have it sorted out and working.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How does Tomcat 6 know to automatically redeploy an application?
 
Similar Threads
JRun vs Tomcat, about the custom action
Configuration files allowed under each web application in tomcat
whereis the dir after deployed on server?
Help with deploying/configuration
Execution dir (in Eclipse)