Skip to main content

Refresh bundle JSP for Websphere commerce 8

As we do in general practice to hit refreshBundles.jsp to clear out resource bundle cache without restarting the server. Recently, I figured out that it no more works with IBM 8 and throws error message like "no such method exists: cache"

Actually, the field "cache" is now replaced with "cacheList". Moreover, its type is now ConcurrentHashMap instead of WeakHashMap.

Change the Java logic of your JSP as below:


<%
Class klass =
     Class.forName("java.util.PropertyResourceBundle").getSuperclass();
Field field = klass.getDeclaredField("cacheList");

//Test block check for all the declared fields. Comment out the loop below.
for (Field classField : klass.getDeclaredFields()) {
System.out.println(classField.getName());
}

field.setAccessible(true);

ConcurrentHashMap cache = (ConcurrentHashMap)field.get(null);
cache.clear();

field.setAccessible(false);
%>


Comments