zhumingvictor
zhumingvictor

Reputation: 109

Reload resource bundle in struts2 in Websphere

I have struts.devMode=true in my struts.properties. Which will cause resource bundle to reload each time. But every time when it try to reload it throws exception below. My application is running on websphere 7. Any help will be appriciated. com.opensymphony.xwork2.util.logging.commons.CommonsLogger error Could not reload resource bundles java.lang.NoSuchFieldException: cacheList

Upvotes: 0

Views: 3913

Answers (2)

user2933412
user2933412

Reputation: 209

the follow solution worked for me in Tomcat 7 and WebSphere Application Server 7.

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

This will clear the ResourceBundle cache.

*devMode and i18n.reload must be false.

Regards,

Felipe

Upvotes: 0

Pigueiras
Pigueiras

Reputation: 19356

You can't work with Struts 2 in devMode and Websphere. There isn't many information on the Internet (in French) but what I can understand with my limited French knowledge is that you have to put the server with production settings.

I mean that your struts.xml must be like this to make Struts2 work on Websphere:

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

The reason that why is this happening is not very clear. The blog explains that maybe is for a different JVM implementation by IBM and maybe it differs in the implementation of the ResourceBundle class that has no private field cacheList and then raises an error when it reloads the i18n labels.

Upvotes: 2

Related Questions