wood burning stoves 2.0*
The moose likes Struts and the fly likes Loading .properties file. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Loading .properties file." Watch "Loading .properties file." New topic
Author

Loading .properties file.

Vijendra Babar
Greenhorn

Joined: Jul 28, 2006
Posts: 18
Hi,
I am using Struts 2.0 on Linux Platform.

Here is my Question:

I have written on JSP that shows list of all form name. On clicking this form name, all fields (Labels) are displayed which are present on corresponding .jsp page.

These label names are given in .properties file.
Now I want to change the content of this .properties file.
Which actually I have completed by rewritting .properties file.

But to see the change in my application I need to restart my Tomcat again, which I really don't want.

According to my knowledge, when ever application is loaded first contents of .properties file are loaded in memory, so even if we change the file contents, references prensent in memory are not changed. For that we compulsorly need to restart Web server.

Is there any alternative solution to see the changes made in .properties file?

Probably solution for this is to refresh entire memory or reload application. OR Through code restart application server.

Is this possible? or are there any alternative solution for this?

(I dont want to Restart Tomcat explicetly)
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
I have been active in this forum for a year and a half now, and in that time several individuals have asked if there is a way to dynamically refresh the message resource bundle. I've seen a few post code that they tried that didn't work, but to my knowledge none of them have reported success with this.

Let's be clear on one thing, though. It is not necessary to restart the server in order to refresh the resouce bundle. It is only necessary to restart the web application. This is normally a considerably faster process than restarting the server.

Here's what I'd recommend: Most application servers have a batch process that will restart an application. I'd set up some sort of trigger process that detects when your .properties file has changed, and have that start the process that restarts the web application.


Merrill
Consultant, Sima Solutions
Vijendra Babar
Greenhorn

Joined: Jul 28, 2006
Posts: 18
Here's what I'd recommend: Most application servers have a batch process that will restart an application. I'd set up some sort of trigger process that detects when your .properties file has changed, and have that start the process that restarts the web application.

Hi,

Thanks for your reply,

You have said about Batch Process in Application Server, does it mean .bat file? As in tomcat startup.bat is provided. Do we need to invoke this .bat file.

If it's something else then can you please tell it more clearly.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Loading .properties file.