Good example on how to fix error through log change. See attachment.
Here is what I've researched about the WARN log messages related to org.apache.struts2.util.TextProviderHelper:
When you reference a message element by its key (in this case format.money or format.moneyDollar), Struts searches for a corresponding message bundle in the following order:
- ActionClass.properties
- Interface.properties
- SuperClass.properties
- model.properties
- package.properties
- struts.properties
- global.properties
So, for example these log lines:
2013-01-25 06:56:16,013 9822751 WARN [org.apache.struts2.util.TextProviderHelper] (ajp-haldevjbs15.hq.halw.com%2F10.194.50.82-8009-3:) The first TextProvider in the ValueStack (com.hal.sf.booking.action.StateroomTypeAction) could not locate the message resource with key 'format.money'
2013-01-25 06:56:16,013 9822751 WARN [org.apache.struts2.util.TextProviderHelper] (ajp-haldevjbs15.hq.halw.com%2F10.194.50.82-8009-3:) The default value expression 'format.money' was evaluated and did not match a property. The literal value 'format.money' will be used.
Are looking for a com.hal.sf.booking.action.StateroomTypeAction.properties file, and in there the property with key: format.money, but this property is defined in a package.properties file.
This is the TextProviderHelper method that is executing:
public static String getText(String key, String defaultMessage, List<Object> args, ValueStack stack, boolean searchStack) {
String msg = null;
TextProvider tp = null;
for (Object o : stack.getRoot()) {
if (o instanceof TextProvider) {
tp = (TextProvider) o;
msg = tp.getText(key, null, args, stack);
break;
}
}
if (msg == null) {
// evaluate the defaultMesage as an OGNL expression
if (searchStack)
msg = stack.findString(defaultMessage);
if (msg == null) {
// use the defaultMessage literal value
msg = defaultMessage;
}
if (LOG.isWarnEnabled()) {
if (tp != null) {
LOG.warn("The first TextProvider in the ValueStack ("+tp.getClass().getName()+") could not locate the message resource with key '"+key+"'");
} else {
LOG.warn("Could not locate the message resource '"+key+"' as there is no TextProvider in the ValueStack.");
}
if (defaultMessage.equals(msg)) {
LOG.warn("The default value expression '"+defaultMessage+"' was evaluated and did not match a property. The literal value '"+defaultMessage+"' will be used.");
} else {
LOG.warn("The default value expression '"+defaultMessage+"' evaluated to '"+msg+"'");
}
}
}
return msg;
}
It iterates over the ValueStack objects and looks for the first one that implements TextProvider. In this case, StateroomTypeAction.java extends ActionSupport and this class implements TextProvider interface, that provides access to the properties files and their text messages. As the msg (tp.getText(key, null, args, stack)) is null, it logs the warn message.
The troubleshoot I found (apparently is a common problem after the Struts 2.0 - 2.1.x migration) is just to turn off the WARN level logging for TextProviderHelper.
I added the following lines in my jboss-log4j.xml file:
<category name="org.apache.struts2.util.TextProviderHelper">
<priority value="error"/>
</category>
and it solved the problem.
Here are some links where I took the info from:
