java.util.MissingResourceException: Can't find bundle for base name messages, locale en_US

digvijay picture digvijay · Jun 7, 2012 · Viewed 14.9k times · Source

I am new to JSF an was trying out this piece of code.. This is my faces-config.xml:

<application>
        <resource-bundle>
            <base-name>messages</base-name>
            <var>msg</var>
        </resource-bundle>
    </application>

messages is a file that stores a few properties and messages file is not placed under any directory, it is placed directly under the application. Why cant i access this file? Thank you in advance.. please do let me know if you need any additional information..

Answer

Daniel picture Daniel · Jun 7, 2012

looks like your file placed in some package inside your src folder

<base-name>some.package.name.Messages</base-name>

also make sure the file called Messages.properties

b.t.w are you aware that Messages.properties file will allow you to override your validators error messages?

Also, take a look at this nice tutorial JSF 2 message and messages example