• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

tomcat caching issue

 
Ranch Hand
Posts: 493
Android Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello ,

I'm using tomcat server and I'm facing a serious problem with it , i made a simple j2ee application that generates reports from DB by choosing the report name and from - to date ,then writes the output in excel file then put it on the tomcat server so the user can just click a link to download the report he made, the problem I'm facing is when i write date range for instance 3-6-2008 till 4-6-2008 the output report is ok but when i try to make a report its date range for instance from 3-7-2008 till 5-7-2008 the output file includes the results of the previous query (3-6-2008 till 4-6-2008), by the way logic and code are Ok , this problem doesn't fix unless i restart the tomcat server, So i think it's a problem related to the tomcat .

Any advice?
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

by the way logic and code are Ok


That being the case, are you saying that the correct (updated) results are written to the file (and that you have verified that), but then the old (no longer existing) file is served to the client?

What is the HTTP response status when a request for an updated file comes in, but an outdated version is served?
 
S Shehab
Ranch Hand
Posts: 493
Android Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ulf Dittmer:

That being the case, are you saying that the correct (updated) results are written to the file (and that you have verified that), but then the old (no longer existing) file is served to the client?

What is the HTTP response status when a request for an updated file comes in, but an outdated version is served?


Thanks for your help , let me describe in more details actually the in the both cases the files wwere written successfully , but in the second case when you open the report file you will find the last query result plus the new figures of the of the new date range (3-7-2008) . for instance when you open MyReport 3-7-2008.xls you will find the data for 3-6-2008 till 4-6-2008 query plus the data for 3-7-2008 query , it's something i assume like caching , but when the server is restated and try to make the same last reports (that got the old query results plus the new query results) it works fine and shows the exact data you asked for..
what making me sure that the code and logic is ok that this was a desktop application and i transfered it to a web application and it was working more than perfect and i didnt face this problem before
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, so it's not that the old data is served INSTEAD of the updated data, it's that BOTH data sets are shown; is that correct? If so, I would say that this statement

in the both cases the files wwere written successfully


is not correct, since in the second case it seems that data is appended to the file, instead of overwriting it.

Have you checked the file on the server (instead of accessing it from the browser), to see what it actually contains?
 
S Shehab
Ranch Hand
Posts: 493
Android Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ulf Dittmer:
OK, so it's not that the old data is served INSTEAD of the updated data, it's that BOTH data sets are shown; is that correct? If so, I would say that this statement

is not correct, since in the second case it seems that data is appended to the file, instead of overwriting it.

Have you checked the file on the server (instead of accessing it from the browser), to see what it actually contains?



Hi Ulf ,

ya i check the file on the server actually it's the same as the one i accessed throw the browser , a small notification each date range will be printed in a separate file so range 3-6-2008 till 4-06-2008 will be printed in MyReports 3-6-2008.xls and so on, so it's not overwriting it's creating a new file .
 
S Shehab
Ranch Hand
Posts: 493
Android Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ulf , do you wanna me to send some figures from the both file for more clarification?
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, if the file on the server actually has data that it shouldn't have, then I'd say that there is something wrong with the application logic.

How are you creating the updated file?
 
S Shehab
Ranch Hand
Posts: 493
Android Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ulf , here are some figures from the files :

this is MyReport 11-8-08.xls (this was created after restarting the sever, so there is nothing wrong in it ) :
as you see here all the figures for date 11-8-08 and that what is desired.

see the next report MyReport 15-8-08.xls it suppose to be for date 15-8-08 only but you can find some figures from 11-8-08 , and this report will be generated right if i restarted the tomcat server ,this why I'm saying it may be tomcat issue

here are some figures :



PS :the 2 dates are in separated excel files no appending or overwriting
Got me now ?
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know what else to say beyond my last post. If the code is creating a file that contains data it shouldn't contain, then it seems there is something wrong with the code that creates the file.
So, one again: how are you creating the file? How can you make sure that the logic is correct? How can you make sure that there are no multithreading issues?
 
S Shehab
Ranch Hand
Posts: 493
Android Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ulf Dittmer:
I don't know what else to say beyond my last post. If the code is creating a file that contains data it shouldn't contain, then it seems there is something wrong with the code that creates the file.
So, one again: how are you creating the file? How can you make sure that the logic is correct? How can you make sure that there are no multithreading issues?



Thanks for your fast reply , ok what proves that the logic and code is ok , 1st this was a desktop application and it was working more than perfect (i nearly used when i transfered it to web application the same classes in the db stuff and making the files ),2nd why when restarting the server the report's output is correct ?!!! and this what will drive me crazy because if it's something wrong in the logic or coding it suppose to give me all the time bad data regardless of i restared the sever or not, i'm not using any multi threading techniques in my application .
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'd add some logging to the code creating the file, so that you can be sure about what data is written at the moment when things go wrong.
 
S Shehab
Ranch Hand
Posts: 493
Android Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ulf thanks much and for your kind help, actually i find the there is a vector need to be cleared , and i didnt face this problem in the desktop vesrion because every time you call for a report this vector is cleared
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic