I am working on a J2SE application (think kiosk-style app) that makes heavy use of resource bundles and i18n. This includes not just translations but also formatting and other i18n concerns. We have custom logic in place to homogenize the resource loading, but it is fairly straightforward. The issue I have is the MissingResourceException
. Even if I bypass the custom logic in place in the application and call directly into the ResourceBundle
class to load this specific bundle, Java is not able to load it for a specific locale. Here is the root exception with stack trace:
Caused by: java.util.MissingResourceException: Can't find bundle for base name version1/FormatResource, locale en_GB
at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:836)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:726)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:576)
The resource bundle is in a directory "version1" placed in a class folder in Eclipse which is at the top of my class path. This folder contains other resource bundles which are loaded fine using the same resource bundle loading logic, as well as numerous XML configs which also load fine when loaded using the system class loader. The relevant files for the resource bundle are:
FormatResource_cs_CZ.properties
FormatResource_en_GB.properties
FormatResource_fr_BE.properties
FormatResource_fr_FR.properties
FormatResource_hu_HU.properties
FormatResource_nl_BE.properties
FormatResource_nl_NL.properties
FormatResource_pl_PL.properties
FormatResource_sk_SK.properties
When my application starts up in the Polish locale, everything is fine. If I log in as a user with the Polish locale, everything is fine. If I log in as a British user, the application attempts to load all the en_GB bundles (translations, formatters, etc) and fails on this bundle. It cannot find FormatResource_en_GB.properties
, which is clearly in the class path: the above file list is a copy and paste from the command line.
One final issue that I find interesting is that if I define FormatResource_en_US.properties
in the version1 directory, then even the FormatResource_pl_PL.properties
file fails to load and the application will not even start.
Anyone have any ideas?