jQuery in Action, 3rd edition
The moose likes Tomcat and the fly likes Apache / mod_webapp / Tomcat caching Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Apache / mod_webapp / Tomcat caching" Watch "Apache / mod_webapp / Tomcat caching" New topic

Apache / mod_webapp / Tomcat caching

Brian Kapellusch

Joined: Oct 03, 2002
Posts: 11
I'm currently using mod_webapp to link Apache to Tomcat 4.0.4. I'm having problems when I upload an updated jar to the lib directory of my app (myapp/WEB-INF/lib). After I restart the app via the Tomcat mananger, the log shows that the app has been restarted, and all of the jars have been loaded.
If I access the app via apache (port 80), my changes don't take effect.
If I access the app via tomcat (port 8180), my changes DO take effect.
Is there some strange caching going on between Apache and Tomcat via mod_webapp that won't let me change jar files and access them via apache? If I restart Tomcat AND Apache, everything works fine via port 80. Unfortunately, I don't have the luxury of restarting Apache at will in production because it's constantly serving up other apps (PHP code).
Any insights would be appreciated....

----------------<br />Brian Kapellusch
Jeff Grummons

Joined: Jan 15, 2002
Posts: 11
you probably have to clear out the files that reference your changed jar file in the /tomcat/work/myapp directory. tomcat compiles the jsp pages and keeps them there in a compiled form for quicker access. so when you make a change to a jar or jsp file, it doesn't always take affect right away. but you can delete these work files and tomcat will recompile the new versions the next time the files are accessed.
that always takes care of it for me. there's no need to restart apache unless you change the httpd.conf file, and I only have to restart tomcat for server.xml changes, web.xml changes, or Jar file changes.
hope this helped
Brian Kapellusch

Joined: Oct 03, 2002
Posts: 11
I thought initially that the problem would have been the natural JSP caching as well, but it's not. Even if I delete all of the files in the work directories, I get problems.
If JSP caching was the problem, I woudln't be able to view the pages correctly via the Tomcat direct port. It's only an issue if I go through Apache to get to Tomcat
I agree. Here's the link: http://aspose.com/file-tools
subject: Apache / mod_webapp / Tomcat caching
It's not a secret anymore!