Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Internationalization problem in Spring MVC integrated with tiles

 
Preetam Patil
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to solve the problem below?


Error :-

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.util.MissingResourceException:
Can't find bundle for base name views, locale en_US

spring-servlet.xml :-


<bean id="viewResolver"
class="org.springframework.web.servlet.view.ResourceBundleViewResolver"
p:basename="views" />

<context:component-scan base-package="com.bwi.sofia.web.controller" />

<bean id="tilesConfigurer"
class="org.springframework.web.servlet.view.tiles2.TilesConfigurer"
p:definitions="/WEB-INF/tiles-defs.xml" />

<!-- Application Message Bundle -->

<bean id="messageSource"
class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basename" value="classpath:messages" /> <property
name="defaultEncoding" value="UTF-8" /> </bean> <bean
id="localeChangeInterceptor"
class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
<property name="paramName" value="lang" /> </bean> <bean
id="localeResolver"
class="org.springframework.web.servlet.i18n.CookieLocaleResolver" />

<bean id="handlerMapping"
class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
<property name="interceptors"> <ref bean="localeChangeInterceptor" />
</property> </bean>


</beans>
 
Mukhi Vla
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have messages.properties file in your classpath?
 
Mark Secrist
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might try being more specific in configuring the location and name of your message.properties files. Try this:



You will probably need to change the path based on where your files are located. In my case, I have a messages directory under WEB-INF where I place my message files. You'll at least need to have your messages.properties file there as well as any locale specific instances in the form of messages_[locale_code].properties (as an example: messages_de.properties for the German locale), etc.

You are getting the message below because it can't even find the default message bundle.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic