• 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:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Recognizing properties file changes without restarting Tomcat

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

After updating a properties file, is there a way for the server to recognize the changes without restarting?


Thanks,
Leah
 
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think it depends "where" the change is taking place. If you have it in a WAR that isn't deployed into "webapps" then I think Tomcat only cares about changes to lib. If it's just a directory somewhere, it's a live so next time you open the file it's the new one. If you've deployed into webapps, obviously you'll need to do that again for any changes to take place in Tomcat.

Does that help any? If not, maybe you can give more information about what's going on and what you mean by "recognizing file changes."
 
Leah Jay
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

The properties file is in a directory inside of webapps. For example:

tomcat\webapps\dir1\dir2\test.properties

When this properties file is updated and stored through Java, the server will not give the updated values if calling the getProperty method.


-Leah
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Didn't you already get an answer to this in another forum (or are two people having the same problem?)
Anyway - create a File object pointing to the properties file and use the lastModified() call to get the timestamp on the properties file when you first read it. You can keep that File object and timestamp as instance variables.
Subsequently, before using the properties, check the timestamp again and re-read if necessary.
Bill
 
So it takes a day for light to pass through this glass? So this was yesterday's tiny ad?
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic