使用Glassfish 3.1.2服务器时,属性文件中的更改不会反映在页面中 [英] Changes in property files does not reflect in page while using Glassfish 3.1.2 server

查看:79
本文介绍了使用Glassfish 3.1.2服务器时,属性文件中的更改不会反映在页面中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用NetBeans IDE,但在外部使用了Glassfish(意味着不是NetBeans随附的.我正在通过ubantu中的终端使用GlassFish).在我的项目中,我正在使用几个属性文件来加载页面上的标签.但是问题是,在运行时对属性文件进行修改时,更改未反映在页面上.我需要重新启动Glassfish服务器. ResourceBundle条目是在faces-config文件中创建的.

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>

我知道,在属性文件中进行更改时,需要清除ResourceBundle(使用ResourceBundle.clearCache();)的缓存.我已经尝试过了.该解决方案可完美地在码头上工作.但是当我使用glassfish服务器时,它是无效的.

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.

推荐答案

通过Google的快速搜索显示了 Glassfish错误报告.简而言之,clearCache()无效,并且目前似乎没有解决方法.

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.

我也遇到了这样的问题-如何重新加载资源包在网络应用程序中?-但我不知道主要答案是否适用于您的情况;即是否可以在Glassfish上使用.

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.

这篇关于使用Glassfish 3.1.2服务器时,属性文件中的更改不会反映在页面中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆