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

在Websphere中的struts2中重新加载资源包,struts2,websphere,resourcebundle,Struts2,Websphere,Resourcebundle,我的struts.properties中有struts.devMode=true。这将导致每次重新加载资源包。但每次尝试重新加载时,它都会抛出下面的异常。我的应用程序正在WebSphere7上运行。任何帮助都将受到感谢。 com.opensymphony.xwork2.util.logging.commons.commonlogger错误无法重新加载资源包 java.lang.NoSuchFieldException:cacheList您不能在devMode和Websphere中使用Struts

我的struts.properties中有struts.devMode=true。这将导致每次重新加载资源包。但每次尝试重新加载时,它都会抛出下面的异常。我的应用程序正在WebSphere7上运行。任何帮助都将受到感谢。
com.opensymphony.xwork2.util.logging.commons.commonlogger错误无法重新加载资源包

java.lang.NoSuchFieldException:cacheList

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

我的意思是,您的
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实现,可能是ResourceBundle类的实现不同,该类没有私有字段缓存列表,然后在重新加载i18n标签时引发错误。

以下解决方案在Tomcat 7和WebSphere Application Server 7中对我有效

LocalizedTextUtil.reset();
ResourceBundle.clearCache(LocalizedTextUtil.class.getClassLoader());
这将清除ResourceBundle缓存

*
devMode
i18n.reload
必须为
false

问候,

菲利佩