Killian
Killian

Reputation: 934

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.

I'm trying to add a basic messages.properties file to my calculator app, working from a tutorial. The tutorial says to "If you are using Eclipse Java EE, be sure to add resources/messages.properties as a source folder."

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

How I reference the properties file in my 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

Upvotes: 1

Views: 10912

Answers (1)

BalusC
BalusC

Reputation: 1109695

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.

  • Create a package resources the in the same place and the same way as you would create a package for your Java code.
  • Drop the messages.properties file in there.
  • Reference it as <message-bundle>resources.messages</message-bundle>.

Upvotes: 2

Related Questions