简体   繁体   中英

“Can't find bundle for base name messages” error

while running my application I get the following error:

javax.el.ELException: /view/doi/common/navigation.xhtml: Can't find bundle for base name messages, locale de_CH
at com.sun.faces.facelets.compiler.TextInstruction.write(TextInstruction.java:90)
at com.sun.faces.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:82)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:302)
at com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:105)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)

In my faces-config I specified this:

<resource-bundle>
  <base-name>messages</base-name>
  <var>msg</var>
</resource-bundle>

and I have a directory src\\web\\resources\\msg with the file messages_en.propeties.

What am I missing?

Based on the exception, the locale that the server is looking for is de_CH or failing that, de . If that fails too, then it will look for 'default' language, but what that is, depends on your system settings. So it may never even go to messages_en.properties . You could provide messages.properties instead (without any locale indicator) to serve as a default, if that's what you want.

Also read here for the full explanation of how the locale resolution works: http://java.sun.com/developer/technicalArticles/Intl/ResourceBundles/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM