Francesco
Francesco

Reputation: 2382

"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?

Upvotes: 4

Views: 11451

Answers (1)

ivantod
ivantod

Reputation: 773

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/

Upvotes: 5

Related Questions