From
http://www.nabble.com/Loading-ResourceBundles-from-JARs-vs.-Classpath-tf3096465s2369.html:
I've discovered an issue while trying to write the JSF Tutorial.
Since JSF doesn't have any facilities (that I know of) for loading the
ResourceBundle defined in faces-config.xml, we're using the regular
ol' ResourceBundle.getBundle() call to load them.
Hopefully the method below and my comment explain the problem I'm having:
public String getText(String key) {
String message;
try {
message = getBundle().getString(key);
} catch (java.util.MissingResourceException mre) {
// When running tests, the the resource bundle is read
from the common-web
// JAR, causing keys to not be found and the following
message to be printed.
// When running the application, the resource bundle is
resolved correctly.
// Not packaging the i18n bundles in the common-web.war
definitely fixes the
// problem. However, then projects that depend on it fails
because keys are
// not found. Commenting out the warning message seems
like the most reasonable
// solution for now. Maybe the warpath plugin can exclude
certains files from
// the classpath?
//log.warn("Missing key for '" + key + "'");
return "???" + key + "???";
}
return message;
}
Possible resolutions:
1. Figure out how to load the ResourceBundle from the filesystem, not
the JAR. I'm guessing this is possible with some classloader magic.
2. Add a feature to the warpath plugin where you can exclude/include
resources from the JAR.
I'm willing to go with #1 if someone knows how to do it. #2 would be
an awesome solution because it would allow users to exclude individual
classes (i.e. SignupAction) and put the class in their project
instead. Mike - how hard would it be to add this feature?
In the meantime, I'll check in the commented out log.warn so users
don't see issues when running unit tests with JSF.