In a project i will customize the jsf resource bundle handler. according to this post:
i18n with UTF-8 encoded properties files in JSF 2.0 application
i add following lines to my faces-config:
<application>
<locale-config>
<default-locale>fa</default-locale>
<supported-locale>en</supported-locale>
<supported-locale>fa</supported-locale>
</locale-config>
<message-bundle>ApplicationResources</message-bundle>
<resource-bundle>
<base-name>org.apache.myfaces.bundle.CustomJsfBundleHandler</base-name>
<var>messages</var>
</resource-bundle>
</application>
And create a handler:
package org.apache.myfaces.bundle;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.util.PropertyResourceBundle;
public class CustomJsfBundleHandler extends PropertyResourceBundle {
public CustomJsfBundleHandler(InputStream stream) throws IOException {
super(stream);
}
public CustomJsfBundleHandler(Reader reader) throws IOException {
super(reader);
}
@Override
public Object handleGetObject(String key) {
// do some customization
return super.handleGetObject(key);
}
}
But when is goto my page i get following Exception :
java.util.MissingResourceException: Can't find bundle for base name org.apache.myfaces.bundle.CustomJsfBundleHandler, locale en at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1564) at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1387) at java.util.ResourceBundle.getBundle(ResourceBundle.java:1082) at org.apache.myfaces.application.ApplicationImpl.getResourceBundle(ApplicationImpl.java:459) at org.apache.myfaces.application.ApplicationImpl.getResourceBundle(ApplicationImpl.java:435) at org.apache.myfaces.el.unified.resolver.ResourceBundleResolver.getResourceBundle(ResourceBundleResolver.java:222) at org.apache.myfaces.el.unified.resolver.ResourceBundleResolver.getValue(ResourceBundleResolver.java:136)
Do you have any idea?