jakub.g
jakub.g

Reputation: 41338

Tomcat can't see newly created static files and is server-side caching the old files

I use Tomcat 7 on Windows XP.

When a change happens to a file in my server dir, it is not reflected:

The above happens no matter how many times I try to reload the file, or even add query string to it (img.jpg?timestamp=...).

In %TOMCATDIR%/conf/context.xml I've set various directives to disable server-side caching:

<?xml version='1.0' encoding='utf-8'?>
<Context antiResourceLocking="true" cachingAllowed="false" cacheMaxSize="1" cacheTTL="1">
    <WatchedResource>WEB-INF/web.xml</WatchedResource>
</Context>

What is wrong?

Upvotes: 5

Views: 15974

Answers (3)

dambo14
dambo14

Reputation: 31

Finally the solution is to replace %TOMCATDIR%/conf/context.xml file content within :

<?xml version='1.0' encoding='utf-8'?>
<Context cachingAllowed="false" cacheMaxSize="1" cacheTTL="1">
    <WatchedResource>WEB-INF/web.xml</WatchedResource>
</Context>

Upvotes: 0

Andre
Andre

Reputation: 410

Tomcat 8 - disable caching of static resources:

context.xml

     <Resources cachingAllowed="false"/>

Upvotes: 0

jakub.g
jakub.g

Reputation: 41338

The solution seems to be remove antiResourceLocking="true".

If anyone's more knowledgable about the topic, or know how to workaround it other way, I'll be grateful.

Upvotes: 2

Related Questions