Bernardo Araujo
Bernardo Araujo

Reputation: 27

"can't find bundle for base name" on JSF messages.properties

I am doing a simple JSF based project (please refer to this image to check out the project structure) but I can't figure out why the faces-config can not reach to the Messages.

Here is the piece of code on the "faces-config.xml" that references the "Messages.properties" file:

    <application>
      <message-bundle>br.com.teste.primeiraaplicacaojsf.web.i18n.Messages</message-bundle>
      <locale-config>
        <default-locale>pt_BR</default-locale>
      </locale-config>
    </application>

Here is the error message generated on the browser:

HTTP Status 500 - Can't find bundle for base name br.com.teste.primeiraaplicacaojsf.web.i18n.Messages, locale pt_BR

type Exception report

message Can't find bundle for base name br.com.teste.primeiraaplicacaojsf.web.i18n.Messages, locale pt_BR

description The server encountered an internal error that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Can't find bundle for base name br.com.teste.primeiraaplicacaojsf.web.i18n.Messages, locale pt_BR
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:671)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
root cause

java.util.MissingResourceException: Can't find bundle for base name br.com.teste.primeiraaplicacaojsf.web.i18n.Messages, locale pt_BR
    java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1564)
    java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1387)
    java.util.ResourceBundle.getBundle(ResourceBundle.java:1082)
    javax.faces.component.MessageFactory.getMessage(MessageFactory.java:161)
    javax.faces.component.MessageFactory.getMessage(MessageFactory.java:251)
    javax.faces.component.UIInput.validateValue(UIInput.java:1149)
    javax.faces.component.UIInput.validate(UIInput.java:982)
    javax.faces.component.UIInput.executeValidate(UIInput.java:1248)
    javax.faces.component.UIInput.processValidators(UIInput.java:712)
    javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1261)
    javax.faces.component.UIForm.processValidators(UIForm.java:253)
    javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1261)
    javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1261)
    javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:1195)
    com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:76)
    com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:658)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)

Upvotes: 0

Views: 2912

Answers (1)

Bernardo Araujo
Bernardo Araujo

Reputation: 27

For some reason IntelliJ project explorer was showing the the path of the "Messages.properties" file as if it was a sequence of folders while behind the curtains it was creating just one folder with the whole path as it's name. The problem was fixed by remaking the folder structure inside the resources folder (the files remain exactly the same).

Upvotes: 2

Related Questions