在Websphere中的struts2中重新加载资源包

时间:2012-09-28 20:20:28

标签: struts2 websphere resourcebundle

我的struts.properties中有struts.devMode = true。这将导致资源包每次重新加载。但每次尝试重新加载时都会抛出异常。我的应用程序正在websphere 7上运行。任何帮助都将得到满足。 com.opensymphony.xwork2.util.logging.commons.CommonsLogger error Could not reload resource bundles java.lang.NoSuchFieldException: cacheList

2 个答案:

答案 0 :(得分:2)

您无法在devMode和Websphere中使用Struts 2。互联网上的信息不多(in French),但我能理解的有限的法语知识是,您必须将服务器置于生产设置中。

我的意思是你的struts.xml必须像这样才能让Struts2在Websphere上运行:

<struts>
   <constant name="struts.devMode" value="false" />
   <constant name="struts.i18n.reload" value="false" />
   <constant name="struts.configuration.xml.reload" value="false" />
   ...
</struts>

为什么会发生这种情况的原因并不十分清楚。该博客解释说,IBM可能针对不同的JVM实现,也许它在没有私有字段 cacheList 的ResourceBundle类的实现方面有所不同,然后在重新加载i18n标签时引发错误。 / p>

答案 1 :(得分:0)

以下解决方案适用于Tomcat 7和WebSphere Application Server 7。

LocalizedTextUtil.reset();
ResourceBundle.clearCache(LocalizedTextUtil.class.getClassLoader());

这将清除ResourceBundle缓存。

* devModei18n.reload必须为false

此致

菲利普