0

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

4

2 回答 2

2

您不能在 devMode 和 Websphere 中使用 Struts 2。Internet 上的信息不多(法语),但我只能以有限的法语知识理解,您必须将服务器设置为生产设置。

我的意思是你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 标签时引发错误。

于 2012-09-28T22:44:20.327 回答
0

以下解决方案在 Tomcat 7 和 WebSphere Application Server 7 中为我工作。

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

这将清除 ResourceBundle 缓存。

*devMode并且i18n.reload必须是false.

问候,

费利佩

于 2014-03-24T04:47:53.297 回答