java “找不到基本名称消息的包”错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7886729/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
"Can't find bundle for base name messages" error
提问by Francesco
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:
在我的 faces-config 中,我指定了这个:
<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.
我有一个目录 src\web\resources\msg,其中包含文件 messages_en.propeties。
What am I missing?
我错过了什么?
回答by ivantod
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.
基于异常,服务器正在寻找的语言环境是de_CH
或失败,de
. 如果这也失败了,那么它会寻找“默认”语言,但那是什么,取决于您的系统设置。所以它甚至可能永远不会去messages_en.properties
。messages.properties
如果这是您想要的,您可以提供(不带任何区域设置指示符)作为默认值。
Also read here for the full explanation of how the locale resolution works: http://java.sun.com/developer/technicalArticles/Intl/ResourceBundles/
另请阅读此处以获取有关区域设置解析如何工作的完整说明:http: //java.sun.com/developer/technicalArticles/Intl/ResourceBundles/