简体   繁体   English

java.util.MissingResourceException:找不到捆绑包的资源

[英]java.util.MissingResourceException: Can't find resource for bundle

I've searched but to no avail. 我已经搜索了,但无济于事。 I'm getting this error in my console when running my JSF application. 运行JSF应用程序时,我的控制台出现此错误。

I'm trying to add a basic messages.properties file to my calculator app, working from a tutorial. 我正在尝试通过教程将基本messages.properties文件添加到计算器应用程序中。 The tutorial says to "If you are using Eclipse Java EE, be sure to add resources/messages.properties as a source folder." 该教程说:“如果您使用的是Eclipse Java EE,请确保将resources / messages.properties添加为源文件夹。”

Is this in the build path of the application? 这是在应用程序的构建路径中吗? because I've tried that and it doesn't work. 因为我已经尝试过了,但是没有用。

File path of my properties file: ProjectName/WebContent/resources/messages.properties 我的属性文件的文件路径:ProjectName / WebContent / resources / messages.properties

How I reference the properties file in my faces-config.xml: 我如何在faces-config.xml中引用属性文件:

<application>
<message-bundle>/JavaServerFaces/WebContent/resources/messages</message-bundle>
</application>

Filepath of my faces-config.xml: ProjectName/WebContent/WEB-INF/faces-config.xml 我的faces-config.xml的文件路径:ProjectName / WebContent / WEB-INF / faces-config.xml

The bundle file has to end up in the classpath and needs to be identified as a classpath resource, not as a local disk file system path nor a web resource. 束文件必须以类路径结尾,并且需要被标识为类路径资源,而不是本地磁盘文件系统路径或Web资源。

  • Create a package resources the in the same place and the same way as you would create a package for your Java code. 在与为Java代码创建包相同的位置和方式下创建包resources
  • Drop the messages.properties file in there. messages.properties文件放在其中。
  • Reference it as <message-bundle>resources.messages</message-bundle> . 将其引用为<message-bundle>resources.messages</message-bundle>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 java.util.MissingResourceException:找不到捆绑包java.util.PropertyResourceBundle的资源 - java.util.MissingResourceException :Can't find resource for bundle java.util.PropertyResourceBundle java.util.MissingResourceException: 找不到包 java.util.PropertyResourceBundle, key 的资源 - java.util.MissingResourceException: Can't find resource for bundle java.util.PropertyResourceBundle, key java.util.MissingResourceException:找不到基本名称的包 - java.util.MissingResourceException: Can't find bundle for base name java.util.MissingResourceException:找不到基本名称的包 - java.util.MissingResourceException: Can't find bundle for base name 资源包中的java.util.MissingResourceException - java.util.MissingResourceException in Resource bundle java.util.MissingResourceException:找不到基本名称包的包 - java.util.MissingResourceException: Can't find bundle for base name Bundle java.util.MissingResourceException:找不到基本名称为ResBundle的包,语言环境为en_GB - java.util.MissingResourceException: Can't find bundle for base name ResBundle, locale en_GB java.util.MissingResourceException:找不到基本名称消息的bundle,locale en_US - java.util.MissingResourceException: Can't find bundle for base name messages, locale en_US 原因:java.util.MissingResourceException:找不到基本名称为LocalStrings,语言环境为en_US的捆绑软件 - Caused by: java.util.MissingResourceException: Can't find bundle for base name LocalStrings, locale en_US java.util.MissingResourceException:找不到基本名称javax.servlet.LocalStrings的包 - java.util.MissingResourceException: Can't find bundle for base name javax.servlet.LocalStrings
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM