Srajan Soni
Srajan Soni

Reputation: 86

Tomcat serves old files even after removing and copying new .war file

I have a maven project ,say hello.In my /var/lib/tomcat8/webapps folder,i have placed its .war file,as hello.war.

Now I made some changes to a js file,run mvn package and copied the target/hello.war to tomcat8/webapps folder. The server still serves old JS file. Things I have tried: 1.Tried opening in private window. 2. Removing Catalina folder in tomcat8/work folder. 3. added to context.xml

But none of them work.Also deleted old hello.war in webapps and copied again,but still problem persists.

However,when i tried copying it as hello1.war in webapps folder,the servers serves the new file. Can someone guide me how to solve the problem?

Upvotes: 0

Views: 7101

Answers (6)

SoldierKB
SoldierKB

Reputation: 53

In my case one file was stale and served old content whatever changes I did, the other one used on the same jsp page was successfully refreshed.
Restart/Publish/Clean Tomcat work directory... in eclipse didn't help.
The only thing which did the trick was cleaning the cache in Firefox.
I still have no clue why first file was saved in cache, and the other - not.

Upvotes: 0

Sagar Jani
Sagar Jani

Reputation: 297

The ideal thing to do and which I normally follow is :

  1. Delete temp folder
  2. Delete work folder
  3. Delete webapps/hello.war file.
  4. Delete webapps/hello folder

Upvotes: 0

user207421
user207421

Reputation: 311039

Tomcat isn't responsible for this. Some intermediate Web cache is doing it, or your browsser itself is caching.

Upvotes: 1

SANTOSHKUMAR SINGH
SANTOSHKUMAR SINGH

Reputation: 476

Clean and rebuild your project war file.

Delete the hello folder from server. Then restart the server.

Sometime .js is loaded from cache, try Ctrl + F5

Upvotes: 3

opensam
opensam

Reputation: 368

Unzip the war at some temp location and check if the unzipped JS file is the one which you are expecting. If it is, clean the tomcat webapps directory by removing the previous version war and the unizpped directories and files from that war. After that, copy the new war into your webapps folder and start the server.

One other thing, if you are using eclipse and using external maven build then after re-building your project refresh that project in your workspace and then copy the war file.

Upvotes: 0

AMB
AMB

Reputation: 1035

Try to undeploy the app from http://localhost:8080 , in tomcat manager, then make shutdown from tomcat/bin and finally copy the war to your webapp folder and startup tomcat again

Upvotes: 0

Related Questions