2014-04-02 47 views
0

我在使用i18n的应用程序中工作,此应用程序在我的开发环境(Windows)中工作良好,但是当我尝试在Linux中部署时,一切似乎都没问题,直到我做出请求并接收消息ReloadableResourceBundleMessageSource.fallbackToSystemLocale无法正常工作

No message found under code 'message.header.inicio' for locale 'pt_BR'. 

我有两个文件

  • messages_pt_BR.properties
  • messages_en.properties

经过大量研究,我将messages_pt_BR.properties更改为messages.properties并将fallbackToSystemLocale设置为false但我继续收到相同的错误。有人可以帮助我吗?

按照我的调度员servlet.xml中

<beans xmlns="http://www.springframework.org/schema/beans" 
xmlns:mvc="http://www.springframework.org/schema/mvc" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:context="http://www.springframework.org/schema/context" 
xmlns:p="http://www.springframework.org/schema/p" 
xmlns:webflow="http://www.springframework.org/schema/webflow-config" 
xsi:schemaLocation=" 
    http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd 
    http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd 
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd 
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd 
    http://www.springframework.org/schema/webflow-config http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.3.xsd"> 

<context:property-placeholder system-properties-mode="OVERRIDE" /> 
<context:component-scan base-package="br.com.company" /> 

<!-- i18n retirado de http://www.mkyong.com/spring-mvc/spring-mvc-internationalization-example/ --> 
<bean id="localeResolver" class="org.springframework.web.servlet.i18n.SessionLocaleResolver"/> 

<mvc:interceptors> 
    <bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor"> 
     <property name="paramName" value="language" /> 
    </bean> 
</mvc:interceptors> 

<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource"> 
    <property name="basename" value="classpath:/br/com/company/web/i18n/messages"/> 
    <property name="defaultEncoding" value="ISO-8859-1"/> 
    <property name="fallbackToSystemLocale" value="false"/> 
</bean> 
<!-- referencias: http://www.mkyong.com/tutorials/spring-mvc-tutorials/ --> 

<mvc:annotation-driven /> 
<mvc:resources location="/resources/" mapping="/resources/**" /> 

<bean id="viewResolver" 
    class="org.springframework.web.servlet.view.InternalResourceViewResolver"> 
    <property name="viewClass" value="org.springframework.web.servlet.view.JstlView" /> 
    <property name="order" value="1" /> 
    <property name="prefix" value="/WEB-INF/views/" /> 
    <property name="suffix" value=".jsp" /> 
</bean> 

<import resource="applicationContext-flow.xml"/> 

回答

0

我发现周围的工作我的问题。在spring标签中,我添加了文本属性,所以即使在我的环境中,应用程序也会显示错误。我有一个后备回退....

<spring:message code="welcome.springmvc" text="default text" /> 

这不是一个更好的解决方案,但工程。