• Post Reply Bookmark Topic Watch Topic
  • New Topic

Servlet grabbing previous data/caching

 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am learning servlets and have successfully queried a MySQL database and displayed the results on a web page. (FINALLY!!)
I am running Tomcat stand alone on a windows XP box for testing.
AFter I execute my servlet, I have to stop and restart TomCat in order for any changes I make to the servlet to take effect.
It seems to keep pulling cached data. Does anyone know if I need to code my servlet to handle this OR if this is a Tomcat issue, could someone move this to that thread?
Thanks
 
Sam Dalton
Author
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With regards to the caching of data, I suspect it is your webbrowser that is caching it (try setting it to always check for a new version of the page, or even shutting it down between requests to verify this.)
You should be able to have Tomcat reload your application if it detects any changes. You will need to add a line to the server.xml file (in the tomcat/conf directory) to define your apllication context, and mark it as reloadable (using the reloadable="true" attribute)
Every time you make a change to your servlet (and recompile it) it SHOULD reload. I have known Tomcat be a bit unreliable w.r.t this, but give it a go
Sam
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Sam. That didn't seem to work though. Does this problem seem to arise on Linux? Because that will be my deployment platform.
Thanks
 
Sam Dalton
Author
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greg,
which part didn't work? The data caching or the reloading?
S
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried both. I set my browser to check for new every time you go to a page. I also deleted all my offline content from the temp internet files. And I set the reloadable="true" in the server.xml file.
 
Sam Dalton
Author
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm, odd. Try using the Tomcat manager app to reload your application....
Look at http://jakarta.apache.org/tomcat/tomcat-4.0-doc/manager-howto.html for a guide to the manager application.
S
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'll give it a shot and let you know. Thanks again Sam.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, that worked. Thanks Sam. Now to just get it to reload like it is suposed to without having to do that. So the end user doesn't have a problem.
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gregg,
Try reading this link in the Apache/Tomcat forum.
http://www.coderanch.com/t/81662/Tomcat/servlet-not-reloading-Tomcat

I did quite a bit of testing with this issue, as it seems to come up quite a bit.

One thing to re-iterate... sometimes Tomcat will not pick up on the changes right away. But if you're patient, they will eventually be picked up.
[ May 09, 2002: Message edited by: Mike Curwen ]
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Mike. I will take a look at that.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!