It's not a secret anymore!
The moose likes Tomcat and the fly likes TomCat running from Eclipse shows old cached data Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "TomCat running from Eclipse shows old cached data" Watch "TomCat running from Eclipse shows old cached data" New topic

TomCat running from Eclipse shows old cached data

Mattias Andersson

Joined: Nov 17, 2010
Posts: 20
I have a peculiar problem working with Eclipse 3.6 and TomCat 7.

I'm developing a webapplication in JSF and been doing that for a while now.

But now, all of a sudden, when i choose my project and goes
[right click]-->"Run As" --> "Run on Server"

...the newly edited xhtml data is showing old stuff on the web page.
I've tried to:
* Reinstall Eclipse
* Reinstall TomCat
* "Clean" choice on "Servers" in Eclipse.
* "Clean TomCat work directory" on "Servers" in Eclipse.

Nothing works.

I assume that Eclipse has som cache stored somewhere, that it doesn't matter what I'll do.

Anyone has any idea?

It's better to be approximately right than exactly wrong.
Mattias Andersson

Joined: Nov 17, 2010
Posts: 20

This is nuts!

I totally evaporated/killed/deleted the old project (including all files).
I started a new project with the same name as the one deleted.

I have a new start page which says something like "hello".

And guess what!!!
The same old cached data from the old deleted project is still presented in my browser!!!

I am clueless.

Now... someone here has any idea??
Fred Ouimet

Joined: Jul 02, 2011
Posts: 2

One thing I can think of is if, after re-installing Eclipse, you kept using the same workspace. By default, when adding a new tomcat server to Eclipse, it's configured to use the workspace's metadata folder to deploy projects so it doesn't affect your real tomcat installation. The folder it deploys to should look like: <your workspace folder>\.metadata\.plugins\org.eclipse.wst.server.core\tmpX.

When you cleaned the tomcat work folders, maybe it couldn't clean that workspace folder for some reason.

In Eclipse, you can change that deploy folder to something else.
- Remove all the projects assigned to tomcat or you won't be able to change the setting (right-click the server / Add and Remove ...).
- Do a Clean (right-click the server / Clean ... ).
- Double-click the server to open the config page.
- In the server location section, select "use Custom location" and specify a folder of your choice as the server path. You can leave "wtpwebapps" as the deploy folder. I usually set something like "C:\virtualTomcat" as the server path.
- Save the file, do another clean and add your projects back to the server (right-click the server / Add and Remove ...).

The advantage of setting a folder as "c:\virtualTomcat" is that it's easily accessible in windows explorer so you can see exactly what is being deployed to the server or even clean it manually. When you see cached pages, go check out the folder to see what got deployed and when you clean the work folders, make sure everything is cleaned properly.

Hope this helps!

Mattias Andersson

Joined: Nov 17, 2010
Posts: 20
Thanks Fred for your exquisite answer.
I've tried a few of those and will embrace the TomCat virtual folder idea.

Eventhough I tried a lot of your ideas I think that the solution that finally worked for me was to clean the "temporary internet files" folder.
Obviously I need to implement the "no-cache" in the response.
I agree. Here's the link:
subject: TomCat running from Eclipse shows old cached data
jQuery in Action, 3rd edition