No message found under code 'user.title' for locale 'en_US' with root cause




Asked on May 02, 2015
Hello,
I am developing Spring MVC internationalization . And getting the error. Please help to find out the root cause. 

javax.servlet.jsp.JspTagException: No message found under code 'user.title' for locale 'en_US'.] with root cause
javax.servlet.jsp.JspTagException: No message found under code 'user.title' for locale 'en_US'.
at org.springframework.web.servlet.tags.MessageTag.doEndTag(MessageTag.java:200)
at org.apache.jsp.WEB_002dINF.views.home_jsp._jspx_meth_spring_005fmessage_005f0(home_jsp.java:152)
at org.apache.jsp.WEB_002dINF.views.home_jsp._jspService(home_jsp.java:84)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:335)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)




Replied on May 02, 2015
There are the possible errors that can be checked.

1. If message source files are in defined place.
2. Is there any message source file for the requested locale.
2. Do have defined a bean named "messageSource".

If using java config, it must be like 

@Bean
public MessageSource messageSource() {
     ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
     messageSource.setBasename("/WEB-INF/messages");
}

Here our message file should be inside WEB-INF as defined.

or
@Bean(name="messageSource")
public MessageSource setUpmessageSource() {}

If we define only

public MessageSource setUpmessageSource() {}

then there is no bean named "messageSource";




Replied on May 02, 2015
Thanks working.

Write Answer











©2024 concretepage.com | Privacy Policy | Contact Us