Changes in property files does not reflect in page while using Glassfish 3.1.2 server

你说的曾经没有我的故事 提交于 2019-12-25 14:34:14

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/13174456/changes-in-property-files-does-not-reflect-in-page-while-using-glassfish-3-1-2-s

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!