I am implementing spring internationalization(i18n). It is working fine in my local environment on eclipse. But when i deploy it on a dev server it gives this error.
javax.servlet.ServletException: javax.servlet.jsp.JspTagException: No message found under code 'property.name' for locale 'en'.
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:916)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:845)
org.apache.jsp.WEB_002dINF.pages.PayLinkForm_002dMercadoPago_jsp._jspService(PayLinkForm_002dMercadoPago_jsp.java:618)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
My spring-mvc-config.xml has these settings :
<!-- For setting internationalization -->
<bean id="localeResolver" class="org.springframework.web.servlet.i18n.SessionLocaleResolver">
<property name="defaultLocale" value="en"/>
</bean>
<!-- call this interceptor before any controller call and change the default language, if language parameter is there in the URL -->
<mvc:interceptors>
<bean id="localeChangeInterceptor" class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
<property name="paramName" value="language" />
</bean>
</mvc:interceptors>
<!-- Register the language.properties -->
<bean id="messageSource"
class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basename">
<value>config/language</value>
</property>
</bean>
I think it is not able to detect the properties file on the dev server due to some kind of path issue. Although the path defined here "config/language" works fine in my local.
I resolved the problem by following steps :
1) replace the language registration by this tag (used org.springframework.context.support.ReloadableResourceBundleMessageSource instead of org.springframework.context.support.ResourceBundleMessageSource ) :
<!-- Register the language.properties -->
<bean id="messageSource"
class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basename" value="/WEB-INF/i18n/language" />
</bean>
2) place the language.properties anywhere in WEB-INF (this was very important) :