Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Loading a properties file in a WS  RSS feed

 
David Brossard
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

The following question has been posted several times already but I didn't quite get the answer I was hoping for. Sorry for the repeat then.

I run Tomcat 5.5 with Axis 1.4. I have a WS that reads a properties file and calls another WS elsewhere based on the properties file's values namely the proxy host and port to be used.

In addition, within the same web-app where my WS sits, I have a servlet that allows me to edit the properties file and change the proxy values (for instance). I can easily load, read, edit, and save the properties file (which is located in the classes folder of the web app). However my WS is not picking up the changes. It keeps on using whatever initial values were in the properties file when Tomcat was first started regardless of the changes made.

Does anyone know how I can make my WS aware of the latest changes in the properties file? Does anyone know why my servlet simply picks it up and directly sees the changes?

Thanks,
David.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone know how I can make my WS aware of the latest changes in the properties file? Does anyone know why my servlet simply picks it up and directly sees the changes?


1. You will need to add code that checks the timestamp on the properties file -OR- provide a new entry point in the web service by which you can tell it to reload the properties.

2. If your servlet reads the properties file every time you start an editing session, naturally it sees the current file. Nothing magic is going on.

Bill
 
David Brossard
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

Thanks for your response. I also saw that you can configure your webapp to be autoreloadable with the following XML snippet:



This snippet has to be either in the owning host element in the Tomcat/conf/catalina/localhost folder or (better yet) in the META-INF folder in a context.xml file. (seen on http://tomcat.apache.org/tomcat-5.5-doc/config/context.html)

However, it doesn't seem to work... Does anyone know why?

In addition, how would I force a reload of the classpath programmatically?

Thanks,
David.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!