1

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

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
Killian
  • 936
  • 3
  • 14
  • 28

1 Answers1

2

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>.
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • Thanks for your help. That certainly helps, my application doesn't 404 any more when I make a calculation. However it doesn't load the messages in the file either.. Any idea what might be causing that? – Killian Jun 14 '13 at 19:00
  • Also there isn't any consol output to hint towards what the error is either – Killian Jun 14 '13 at 19:05
  • How exactly did you conclude that it doesn't load the messages? Are you sure that you aren't confusing resource bundle with message bundle like as many starters? See also http://stackoverflow.com/questions/2668161/when-to-use-message-bundle-and-resource-bundle/ – BalusC Jun 15 '13 at 19:52
  • Because the messages I'm putting in the resources file aren't showing. I'm not 100% sure on the difference between the two, but I'm following this tutorial http://www.ibm.com/developerworks/java/tutorials/j-jsf1/section4.html which is using messagebundle so I assume it's correct. – Killian Jun 17 '13 at 15:49