0

I have problem with Tomcat 6.0.29 on EC2 Fedora8 64bit 2.6.21.7-2.ec2.v1.2.fc8xen. There is running java webapp with symlinked static data folder. Something like that:

/home/user/tomcat/webapps/my-app/staticdata
/home/user/staticdata

The issue araised when i am changing data from /home/user/staticdata. Tomcat just doesn't see those changes, and keep returning the old files. Although when i am trying to get this files from different browser, tomcat returns me most recent ones. I have tried cachingAllowed="false"in context.xml but it doesn't work.

So, i would like to have hot data redeploy, without tomcat stopping.

Thanks in advance.

IgorDiy
  • 919
  • 1
  • 12
  • 25
  • Possibly related: http://stackoverflow.com/q/3743136/1183284. Did you make sure the browser isn't caching anything? – MartinK May 31 '12 at 13:48
  • Can you speak to the nature of this "Static Data". If it gets loaded into memory on container start you can change it all day long and unless it gets loaded again its not going to change the in-memory representation. – nsfyn55 May 31 '12 at 13:53
  • Even after clearing cache in Chrome or Firefox it still returning old files. – IgorDiy May 31 '12 at 13:53
  • static data can be changed any time and i don't want to stop tomcat and clear work dir. Any ideas? – IgorDiy May 31 '12 at 13:55
  • Are you sure the browser is re-requesting the file from the server? Please check using a utility like fiddler, LiveHTTPHeaders, FireBug, etc. or even a packet sniffer like Wireshark. Since "a different browser" will give you the latest file, perhaps the original browser is just using its own cached copy of the file. – Christopher Schultz May 31 '12 at 15:50
  • Also note that when you undeploy your webapp, you will probably have the entire contents of your /home/user/staticdata deleted. – Christopher Schultz May 31 '12 at 15:51

1 Answers1

0

You should read this post where another person tried to do what you are suggesting. Deployments should generally be treated as static. If they need to change you redeploy. If uptime is that paramount you should consider a load balancer with session affinity enabled. This will allow you to execute a soft roll-over while preserving in flight sessions.

To do what you are suggesting you would need a thread that monitored the file system for changes and reloaded the static data periodically. The issue is that spawning your own threads is a major container no-no. Secondly I can easily see this leading to you sucking up all your perm gen or something of that nature and ultimately crashing your JVM at an inopportune moment.

Community
  • 1
  • 1
nsfyn55
  • 14,875
  • 8
  • 50
  • 77