0

I am using NetBeans IDE but I am using Glassfish externally(means not that which comes with NetBeans. I am using GlassFish through terminal in ubantu). In my project I am using several property file to load label on page. But the problem is when modification made to property file at run time, that changes are not reflected on page. I need to restart Glassfish server. ResourceBundle entry are made in faces-config file.

//faces-config.xml
<locale-config>
        <default-locale>en</default-locale>
</locale-config>
<resource-bundle>
    <base-name>ValidationMessages</base-name>
    <var>msg</var>
</resource-bundle>
<message-bundle>ValidationMessages</message-bundle>

I know, I need to clear cache of ResourceBundle( using ResourceBundle.clearCache(); ) when changes are made in property file. And I already tried that. This solution perfectly works in jetty. But it is ineffective when I use glassfish server.

BenMorel
  • 34,448
  • 50
  • 182
  • 322
Jemish Patel
  • 444
  • 3
  • 13

1 Answers1

2

A quick Google search revealed this Glassfish Bug Report. In short, clearCache() is not effective, and there doesn't appear to be a workaround at this time.

I also came across this SO question - How to reload resource bundle in web application? - but I couldn't figure out if the main Answer would be applicable in your case; i.e. if it works on Glassfish.

Community
  • 1
  • 1
Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
  • That bug is reported more than a year ago and Glassfish people does't have solution for that at this time. STRANGE.... – Jemish Patel Nov 01 '12 at 10:08
  • It is marked as unimportant ... so it is not strange at all that they haven't worked on it. But, hey, you are free to develop a fix for the problem and submit it as a patch or pull request or whatever. – Stephen C Nov 01 '12 at 10:44