Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can I force Tomcat 5.5 to clear it's cache of web apps?

 
Alex Ryan
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I usually deploy web apps to my production server in expanded form so that I can edit the context.xml file to point to my production database instead of my development one.
However, I accidentally deployed a war file and now I seem to be somewhat screwed.
Tomcat seems to have cached the information in the context.xml file and now I can't deploy.
Even though both the war file and the expanded directory have been physically deleted from webapps directory, catalina.out still shows that tomcat is trying to load them and finding errors in the context files.
I tried putting new war files in the webapps directory, but Tomcat ignores them for some reason.
I'm not sure where Tomcat is caching this information but I think I need a way to make Tomcat clear its cache so that to can load the new versions that I am deploying to the webapps directory.
Restarting and rebooting did not help.
Anybody have any ideas?

P.S. Just to make it concrete, here is what I am seeing in catalina.out ..

INFO: Container org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/quotations] has not been started
May 15, 2010 4:34:05 AM org.apache.catalina.core.StandardContext resourcesStart
SEVERE: Error starting static Resources
java.lang.IllegalArgumentException: Document base /usr/java/apache-tomcat-5.5.17/webapps/iVote does not exist or is not a readable directory

This information was contained in a context.xml file inside of a quotations web app which has been physically deleted.
It's trying to start a web app with bad config that no longer exists and is ignoring the new versions that I deploy.
 
Charles 'King
Ranch Hand
Posts: 56
Eclipse IDE Postgres Database Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The choice is yours. You can either continue debugging and/or wait for a few anecdotal responses. I'd uninstall tomcat, then reinstall it.
 
Alex Ryan
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Charles.
I tried that.
Unfortunately it seems that fedora's un-install does not wipe out the cache because the problem is still there after a re-install.
I also tried going into the admin tool and physically deleting the context there.
But it keeps coming back. LOL.
Methinks somebody on the tomcat dev team has an interesting sense of humor.

If anybody has a solution to this problem I'd very much appreciate it.
I'm at the point now where the only way I know how to deploy a simply web app to tomcat is to re-install my entire operating system.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If this was my problem I would be doing a file search for the text "iVote"

I would also be looking for a directory named "iVote" somewhere where Tomcat can see it.

Bill
 
Misha Ver
Ranch Hand
Posts: 470
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try to delete Tomcat's 'work' directory
 
Alex Ryan
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the helpful suggestions.
catalina.out gave me a hint as to where the information was being cached.
There were multiple cached versions of the context.xml file in /etc/tomcat5/Catalina/localhost/
I'm guessing that this is the work directory?
Anyways, deleting these files made my problem go away.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64973
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you mean tomcat5/conf/Catalina/localhost/ ?

And no, that's not the work folder. That's the folder where Tomcat will store the context definition files for your web apps. This file is an important part of your web app that you should be creating when deploying the web app. As you've noticed Tomcat will create one if it auto-deploys an app if you do not create it yourself.

You should familiarize yourself with the use of this file and understand how Tomcat uses it to map web applications to their context paths.
 
Alex Ryan
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the info Bear.
Much appreciated.
P.S. *Loved* the jQuery in Action book. It's one of my faves. Very well written.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64973
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Alex!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic