Announcement Announcement Module
Collapse
No announcement yet.
i18n resources not found when deploying on server Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • i18n resources not found when deploying on server

    Hi,

    I use Spring I18N support in my web application:

    Code:
      <bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
    	<property name="basenames">
    	  <list>
    	  	<value>/I18N/I18NGesi</value>
    	  	<value>/I18N/I18NPsiche</value>
    	  	<value>/I18N/I18NMonitor</value>
    	  	<value>/I18N/I18NInterruzioni</value>
    	  	<value>/I18N/I18NTicket</value>
    	  	<value>/I18N/I18NWfm</value>
    	  	<value>/I18N/I18NRisorse</value>
    	  	<value>/I18N/I18NReperibilita</value>
    	  	<value>/I18N/I18NReport</value>
    	  	<value>/I18N/I18NGenerali</value>
    	  </list>
    	</property>
    	<property name="cacheSeconds">
    	  <value>${message.reload.cache.seconds}</value>
    	</property>
    	<property name="useCodeAsDefaultMessage" value="true"/>
    	<property name="defaultEncoding" value="UTF-8"/>
      </bean>
    the properties file for locale it and ro are all properly contained in the WAR in webapproot/I18N directory. The configuration works properly when I test it on the server installed in my local machine; however, when I deploy the application on production server, each time the cache seconds expire and I navigate to a localized page, the system slows down a little and the properties don't get updated. The server log shows:

    Code:
    2010-07-15 10:46:22,299 DEBUG [org.springframework.context.support.ReloadableResourceBundleMessageSource] - Loading properties [I18NReport_it.properties] with encoding 'UTF-8'
    2010-07-15 10:46:22,319 DEBUG [org.springframework.context.support.ReloadableResourceBundleMessageSource] - No properties file found for [/I18N/I18NReport_it_IT] - neither plain properties nor XML
    2010-07-15 10:46:22,319 DEBUG [org.springframework.context.support.ReloadableResourceBundleMessageSource] - No properties file found for [/I18N/I18NReport] - neither plain properties nor XML
    2010-07-15 10:46:22,320 DEBUG [org.springframework.context.support.ReloadableResourceBundleMessageSource] - ServletContext resource [/I18N/I18NGenerali_it.properties] could not be resolved in the file system - assuming that is hasn't changed
    java.io.FileNotFoundException: ServletContext resource [/I18N/I18NGenerali_it.properties] cannot be resolved to absolute file path - web application archive not expanded?
    	at org.springframework.web.util.WebUtils.getRealPath(WebUtils.java:232)
    	at org.springframework.web.context.support.ServletContextResource.getFile(ServletContextResource.java:145)
    	at org.springframework.core.io.AbstractResource.getFileForLastModifiedCheck(AbstractResource.java:132)
    	at org.springframework.core.io.AbstractResource.lastModified(AbstractResource.java:116)
    	at org.springframework.context.support.ReloadableResourceBundleMessageSource.refreshProperties(ReloadableResourceBundleMessageSource.java:463)
    	at org.springframework.context.support.ReloadableResourceBundleMessageSource.getProperties(ReloadableResourceBundleMessageSource.java:439)
    	at org.springframework.context.support.ReloadableResourceBundleMessageSource.resolveCodeWithoutArguments(ReloadableResourceBundleMessageSource.java:272)
    	at org.springframework.context.support.AbstractMessageSource.getMessageInternal(AbstractMessageSource.java:192)
    	at org.springframework.context.support.AbstractMessageSource.getMessage(AbstractMessageSource.java:127)
    	at org.springframework.context.support.AbstractApplicationContext.getMessage(AbstractApplicationContext.java:1192)
    	at org.springframework.web.servlet.tags.MessageTag.resolveMessage(MessageTag.java:227)
    	at org.springframework.web.servlet.tags.MessageTag.doStartTagInternal(MessageTag.java:165)
    	at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:79)
    	at jsp_servlet._gesi._online._root.__news._jsp__tag0(__news.java:204)
    	at jsp_servlet._gesi._online._root.__news._jspService(__news.java:157)
    	at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
    	at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:226)
    	at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:124)
    	at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
    	at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
    	at weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:528)
    	at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:261)
    	at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
    	at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
    	at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1063)
    	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:801)
    	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
    	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
    	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    	at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:226)
    	at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:124)
    	at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
    	at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
    	at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3395)
    	at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    	at weblogic.security.service.SecurityManager.runAs(Unknown Source)
    	at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2140)
    	at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2046)
    	at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1366)
    	at weblogic.work.ExecuteThread.execute(ExecuteThread.java:200)
    	at weblogic.work.ExecuteThread.run(ExecuteThread.java:172)
    It seems that some of the files are properly refreshed, while others are just "not found". What could possibly be the problem?

    Thanks,

    Enrico

  • #2
    War exploded??

    Hi,

    In the production env, may be your war is not exploded/expanded and on your local system the war is being exploded and hence it is able to reload the same .

    -Hetal

    Comment


    • #3
      Hi Hetal, thank you for your answer.

      Both in local and in production environment I deploy on Weblogic 10.0 with stage mode; this means the ear/war is copied onto every deployment target (i.e. server / cluster). In both environments, I verified that the ear gets correctly copied into the "stage" directory of the server and that the webapp resources (i.e. everything contained inside the web app root, including properties files) are expanded in the tmp/_WL_user (this is where I substitute updated jsps and localization files without having to redeploy the app; the jsp switching works for both local and production environment, while the i18n files switching only works on my local environment).

      Weird thing is, I've used localization in the production server for almost a year and it worked well till last month, when the error started filling the application log. Thinking about what could have caused the change, my only recent modifications on the i18n systems were the adding of the property
      Code:
      <property name="defaultEncoding" value="UTF-8"/>
      and the conversion of the localization files in utf-8 format (since I needed special characters for the romanian language).

      Other recent modification I can recall was updating Spring from version 3.0.0.M4 to 3.0.3.RELEASE.

      If I don't solve the problem, I can still disable refreshing (i.e. cache forever) for production environment, but this would mean waiting for next redeploy to, for example, correct misspelled translations, while I introduced the ReloadableResourceBundleMessageSource to be able to correct translations on the fly in production environment.

      Comment

      Working...
      X