GeeCON Prague 2014*
The moose likes Tomcat and the fly likes tomcat caching Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » Tomcat
Bookmark "tomcat caching" Watch "tomcat caching" New topic
Author

tomcat caching

Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30598
    
154

I set up my context in <Tomcat root>/conf\Catalina\localhost to point to


Based on the documentation (and a colleague's comments), I thought docBase would be the root of my war. That way when i change class files or html files, they automatically get noticed. However, when I edit HTML files, Tomcat ignores them. I noticed Tomcat created a directory in <Tomcat root>\temp which has a copy of the web app each time I start Tomcat.

I tried adding another flag, but the caching still occurs.


Is there something else I need to set?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Misha Ver
Ranch Hand

Joined: Mar 03, 2008
Posts: 470
Have you removed the application cache folder in /work/Catalina/localhost after setting the cachingAllowed flag to "false"?
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

I'ver never experienced this but I also know that you are using Freemarker (and I really never have) and I wonder if there is some caching going on with freemarker.


GenRocket - Experts at Building Test Data
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30598
    
154

Misha,
I just tried deleting that directory along with the temp directory. After restarting the server, it created "<tomcat root>\temp\0-jforum". Which Tomcat then reads from instead of the desired directory in my Eclipse workspace.

Gregg,
I think it's pretty clear that the temp directory is storing a copy of what the exploded ear looks like on server startup. The same (caching) problem occurs if I try changing a .sql file. The question is why is there a temp directory with a copy of the exploded ear.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30598
    
154

Or maybe that directory is a red herring. The class files are definitely reloading automatically as I can add lines to a file and have the debugger pick them up when I go through the web app.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30598
    
154

Gregg Bolinger wrote:I'ver never experienced this but I also know that you are using Freemarker (and I really never have) and I wonder if there is some caching going on with freemarker.

One other thing. If I change the html file in the temp directory, the web app does pick it up.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

What happens if you use docBase="<workspace>\JForum\src\main\webapp\yourear.ear" instead ? Actually, it should be a WAR, but I'm not sure what you are doing.


[My Blog]
All roads lead to JavaRanch
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30598
    
154

Christophe,
I don't have an ear, just a war.

This only makes sense if you are a moderator - I'm trying to run JForum in the configuration Gregg suggested.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

Jeanne Boyarsky wrote:This only makes sense if you are a moderator - I'm trying to run JForum in the configuration Gregg suggested.

Wasn't this meant to point to "src\main\webapp", not to a war file ?
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

Ok, I have the same problem. I was working on /templates/default/admin/forum_form.htm, but it doesn't show my changes. My saved file is not being copied to the temp directory.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

It works if I remove antiResourceLocking="true"
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Christophe Verré wrote:It works if I remove antiResourceLocking="true"


That's interesting. Normally, I've experienced the need for that when working on Windows because Tomcat will lock files so you can't save them otherwise.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30598
    
154

Christophe Verré wrote:It works if I remove antiResourceLocking="true"

That works for me too. I'll remove antiResourceLocking from the setup document. And now Tomcat doesn't create a copy of the war in the temp folder.

Interestingly, according to a bug report, this was fixed in 2005.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

Interestingly, according to a bug report, this was fixed in 2005.

What I understand from that report is that the only thing changed was the documentation.
 
GeeCON Prague 2014
 
subject: tomcat caching