aspose file tools*
The moose likes Struts and the fly likes struts2 properties file reload Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts2 properties file reload" Watch "struts2 properties file reload" New topic
Author

struts2 properties file reload

debraj mallick
Ranch Hand

Joined: Mar 08, 2011
Posts: 188

hi all,

i have in my struts.properties

also in my struts.xml

but when i make any changes to my global.properties file, it does not show any reflection on jsp pages, all i need is to reload my properties file.
i have gone thru the instructions form http://struts.apache.org/2.x/docs/devmode.html but i didnot understand what i am missing.
i have search entire coderanch for help, but not able to solve the problem.

any help would be appreciated.
debraj mallick
Ranch Hand

Joined: Mar 08, 2011
Posts: 188

hi there,

i have found one link, where the properties files are reloaded each time you make any changes
http://www.nabisoft.com/tutorials/struts2/basic-struts2-project-setup

but i am not able to do so in my application.

please suggest me what i am missing.
Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

Put log4j in debug mode and check whether it is hitting to ConfigurationManager class or not on each and every request.

DEBUG ConfigurationManager:68 - Checking ConfigurationProviders for reload. Like this you can find the message in console.


ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.
debraj mallick
Ranch Hand

Joined: Mar 08, 2011
Posts: 188

hi Mohana Rao,

i have log4j.xml which is like

but it does not shows that properties file are reloading on every request, but my point is when i have "struts.i18n.reload=true" then why the properties file is not reloading on each request because as per the struts2 documentation i am correct.
what i am missing
Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

post your debug messages let me check what's going wrong.
debraj mallick
Ranch Hand

Joined: Mar 08, 2011
Posts: 188

hi Mohana,

my welcome.jsp is like

global.properites

welcome.java

struts.xml

struts.properties

log4j is already pasted above. when i make any changes to properties file, it does not show any changes in my application unless i compile and deloy the war. if you find what i am missing, do let me know.
here is the struts2 document link http://struts.apache.org/2.x/docs/devmode.html




Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

Which browser you are using? Because if you are using IE it will send the request to the action class if it's already requested trying to get the data from the cache. if you are using IE use ctrl + F5 to make a new request.

And once try this example http://struts.apache.org/2.2.1/docs/message-resource-files.html.

And try to declare in different level like package level class level.
debraj mallick
Ranch Hand

Joined: Mar 08, 2011
Posts: 188

hi Mohana,

i have checked using IE 7/8, FireFox5/6, Safari 5.1 and chrome, the problem remains the same.
also thanks for the link, but it seem like i have missing something.
Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

post console messages and put log4j in debug mode.
debraj mallick
Ranch Hand

Joined: Mar 08, 2011
Posts: 188

hi there,

i have tried all these but don't know what to do.
debraj mallick
Ranch Hand

Joined: Mar 08, 2011
Posts: 188

hi all,

i was using struts 2.1.8.1, instead of this when i use struts 2.2.3.1, the problem is soved.
this issue is solved in the latest version of struts2.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: struts2 properties file reload