Reputation: 1389
Hi I am trying to configure message sources in my Spring MVC web application .
I have currently got it running with ReloadableResourceBundleMessageSource but I am not able to get it running with ResourceBundleMessageSource . I would have preferred to use ResourceBundleMessageSource because I dont need the Reload capability and ResourceBundleMessageSource is slightly more efficient.
in my rootApplicationContext , I have defined the beans as follows.
<bean id="messageSource"
class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basename" value="/resources/locale/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.SessionLocaleResolver" />
<bean id="handlerMapping"
class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
<property name="interceptors">
<ref bean="localeChangeInterceptor" />
</property>
</bean>
This works FINE ..
But as soon as I change to
<bean id="messageSource"
class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basename" value="/resources/locale/messages" />
<property name="defaultEncoding" value="UTF-8"/>
</bean>
The application breaks with the exception :
12:35:57,433 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/SpringJAXWS].[jsp]] (http-localhost-127.0.0.1-8080-1) Servlet.service() for servlet jsp threw exception: org.apache.tiles.util.TilesIOException: JSPException including path '/jsp/views/layout/top.jsp'. at org.apache.tiles.servlet.context.ServletUtil.wrapServletException(ServletUtil.java:241) [tiles-servlet-2.2.2.jar:2.2.2] at org.apache.tiles.jsp.context.JspTilesRequestContext.include(JspTilesRequestContext.java:105) [tiles-jsp-2.2.2.jar:2.2.2]
HELP !
https://github.com/localghost8080/JaxWS
https://github.com/localghost8080/JaxWS/blob/master/ResourceBundleException.txt
Upvotes: 7
Views: 4179
Reputation: 1
ResourceBundleMessageSource uses a different format for passing basename values
<bean id="messageSource"
class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basename" value="resources.locale.messages" />
<property name="defaultEncoding" value="UTF-8"/>
Upvotes: 0