Error using multiple message bundles messages_en.properties in EAR.
Issue
- We have multiple web/ejb applications inside single EAR. Each web/ejb application has defined its own message bundle messages_en.properties.
Example, we have two web/ejb applications namely ACC and NPSS.
1) ACCEJB and NPSSEJB’s components.xml has defined following element:
<core:resource-loader>
<core:bundle-names>
<value>messages</value>
<value>statuses</value>
</core:bundle-names>
</core:resource-loader>
2) Both ACCEJB and NPSSEJB have their respective messages property file. And distinct key name and key values are defined.
3) Both ACCEJB and NPSSEJB have their respective java files which read key names from their respective message bundles.
4) After JBoss starts, and the user goes to ACC application, the java code run’s ok (the one which reads the key name properties from message property file).
5) Now if the user goes to NPSS application, the user would receive the following exception:
The exception complains about missing key name “NPS.medical”, although this is defined in its respective message bundle file. See below.
6) After Jboss starts, and the user goes directly to NPSS application, this time the java code runs ok (the one which reads the key name properties from message property file) compared to step 5 where it failed.
We want to verify from JBoss end, if this is an expected (by design) behavior where message bundle loaded from ejb/web applications is used by another web application instead of using its own message bundle. In other words, the message bundle loaded by first come in application is shared by other web applications in the same ear.
We'd also like to know what our options are to assure more deterministic behavior where each web app uses it's own message bundle.
Exception:
Caused by: java.util.MissingResourceException: Can't find resource for bundle org.jboss.seam.core.SeamResourceBundle, key NPS.medical
at java.util.ResourceBundle.getObject(ResourceBundle.java:352)
at java.util.ResourceBundle.getString(ResourceBundle.java:312)
at com.fhlbny.nps.session.util.NPSFileUtility.<clinit>(NPSFileUtility.java:58)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:196)
... 70 more
Environment
- JBoss Enterprise Application Platform (EAP) 4.3.0.GA_CP06
- Seam 2.1.0.sp1
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
