2

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.

ishanbakshi
  • 1,915
  • 3
  • 19
  • 37
  • 1
    Can you please check the files are available in the .war file and in the deployment directory? Does the error occure for all messages oder just for one? – try-catch-finally Nov 13 '15 at 06:52
  • I had a look at the .war file and the properties files are not there. I tried doing the maven build again, but they were still not there. Any suggestion how can I get them to be there? And yes this problem is there for all properties, just that i am using a default text everywhere else in case the text is not found, so other properties are not throwing an error but instead showing the default text. – ishanbakshi Nov 13 '15 at 07:56

1 Answers1

0

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) :

ishanbakshi
  • 1,915
  • 3
  • 19
  • 37