Slepetc / jappstart

Automatically exported from code.google.com/p/jappstart
0 stars 0 forks source link

issue resolving bundle when running local on en_GB environment #3

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Environment: linux with locale : LANG=en_GB.utf8

Command: mvn clean gae:run -P local

Error: 

02-Oct-2010 19:36:20 
org.springframework.context.support.ResourceBundleMessageSource 
getResourceBundle
WARNING: ResourceBundle [messages] not found for MessageSource: Can't find 
bundle for base name messages, locale en_GB
02-Oct-2010 19:36:29 
org.springframework.context.support.ResourceBundleMessageSource 
getResourceBundle
WARNING: ResourceBundle [messages] not found for MessageSource: Can't find 
bundle for base name messages, locale en_GB
02-Oct-2010 19:36:53 
org.springframework.context.support.ResourceBundleMessageSource 
getResourceBundle
WARNING: ResourceBundle [messages] not found for MessageSource: Can't find 
bundle for base name messages, locale en_us
02-Oct-2010 19:36:53 
org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver 
logException
WARNING: Handler execution resulted in exception
org.springframework.context.NoSuchMessageException: No message found under code 
'mail.subject' for locale 'en_us'.
    at org.springframework.context.support.AbstractMessageSource.getMessage(AbstractMessageSource.java:135)
    at com.jappstart.service.mail.MailService.sendActivationEmail(MailService.java:133)
    at com.jappstart.controller.task.MailTask.sendActivationMail(MailTask.java:100)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.google.appengine.tools.development.agent.runtime.Runtime.invoke(Runtime.java:100)
    at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
    at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:427)
    at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:415)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:788)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:717)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
    at com.opensymphony.sitemesh.webapp.SiteMeshFilter.obtainContent(SiteMeshFilter.java:129)
    at com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:77)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
    at com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:70)
    at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:327)
    at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:126)
    at org.tuckey.web.filters.urlrewrite.NormalRewrittenUrl.doRewrite(NormalRewrittenUrl.java:195)
    at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:159)
    at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:141)
    at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:90)
    at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:417)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.appengine.tools.appstats.AppstatsFilter.doFilter(AppstatsFilter.java:140)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:343)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:112)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:187)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    at org.springframework.security.web.access.channel.ChannelProcessingFilter.doFilter(ChannelProcessingFilter.java:109)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:149)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at org.springframework.web.filter.ShallowEtagHeaderFilter.doFilterInternal(ShallowEtagHeaderFilter.java:58)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:58)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:122)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
    at com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:70)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:349)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:326)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
    at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:938)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:755)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
02-Oct-2010 19:37:00 
org.springframework.context.support.ResourceBundleMessageSource 
getResourceBundle

Original issue reported on code.google.com by chsnow...@gmail.com on 2 Oct 2010 at 6:56

GoogleCodeExporter commented 8 years ago
A workaround was to copy messages_en_US.properties to messages_en_GB.properties

Original comment by chsnow...@gmail.com on 2 Oct 2010 at 7:00

GoogleCodeExporter commented 8 years ago
Yes, you would need a relevant en_GB properties file if you want to 
legitimately use that locale. Regardless, I will look into preventing the 
exception.

Original comment by tlees...@gmail.com on 2 Oct 2010 at 7:19

GoogleCodeExporter commented 8 years ago
Chris,

I just tried to reproduce the exception you included in the issue and I wasn't 
able to. Please tell me the steps you used as well as whether or not this was 
on the local jetty/development server or GAE itself? In my development 
environment it seems to be correctly defaulting to en_US when en_GB is not 
found.

- Taylor

Original comment by tlees...@gmail.com on 2 Oct 2010 at 8:09

GoogleCodeExporter commented 8 years ago
Chris,

Just saw this piece of the exception: "WARNING: ResourceBundle [messages] not 
found for MessageSource: Can't find bundle for base name messages, locale 
en_us". Do you still have the en_US properties file as well? en_US is set as 
the default in the Spring configuration so it needs to be there or the default 
needs to be changed.

Thank you,
Taylor

Original comment by tlees...@gmail.com on 2 Oct 2010 at 8:11

GoogleCodeExporter commented 8 years ago
1) git clone git://github.com/tleese22/google-app-engine-jappstart.git 
2) cd google-app-engine-jappstart/
3) mvn gae:unpack
4) mvn clean compile -P local 
5) mvn clean gae:run -P local

6) Navigate to:  http://localhost:8080/register/create
7) Enter a new Account

Browser displays: 
=====

Account created successfully!

Please check your e-mail to activate your account.

=====
My locale:
$ locale
LANG=en_GB.utf8
LC_CTYPE="en_GB.utf8"
LC_NUMERIC="en_GB.utf8"
LC_TIME="en_GB.utf8"
LC_COLLATE="en_GB.utf8"
LC_MONETARY="en_GB.utf8"
LC_MESSAGES="en_GB.utf8"
LC_PAPER="en_GB.utf8"
LC_NAME="en_GB.utf8"
LC_ADDRESS="en_GB.utf8"
LC_TELEPHONE="en_GB.utf8"
LC_MEASUREMENT="en_GB.utf8"
LC_IDENTIFICATION="en_GB.utf8"
LC_ALL=

Original comment by chsnow...@gmail.com on 5 Oct 2010 at 2:19

GoogleCodeExporter commented 8 years ago
So you never actually do a http://localhost:808/anyurl?locale=en_GB to change 
the locale? The issue isn't making too much sense to me since I can't reproduce 
it and in theory since the default locale configured in Spring is en_US (see 
dispatcher-servlet.xml) it should just default to the US English verbiage. I 
tried changing the locale via ?locale=en_GB and it defaulted to the en_US text 
w/o needing an en_GB properties file.

This part of the exception is also confusing:
org.springframework.context.NoSuchMessageException: No message found under code 
'mail.subject' for locale 'en_us'.

...since it would seem to imply that there is no en_US properties file.

Original comment by tlees...@gmail.com on 5 Oct 2010 at 3:38

GoogleCodeExporter commented 8 years ago
Hi Taylor, no I didn't change the locale in the URL.

I have just tried copying the en_US file to en_us:

cp src/main/resources/messages_en_US.properties 
src/main/resources/messages_en_us.properties

Having both en_US and en_us files has fixed the problem for me.

I will try and change the system locale later if you still want me to.

Original comment by chsnow...@gmail.com on 5 Oct 2010 at 6:27

GoogleCodeExporter commented 8 years ago
Interesting, doesn't sound like it's the system locale then. Linux does have 
case sensitive file names. I suspect that is the problem since I've been 
testing on Windows. I will make an update to change the properties files to 
lowercase.

Original comment by tlees...@gmail.com on 5 Oct 2010 at 7:13

GoogleCodeExporter commented 8 years ago

Original comment by tlees...@gmail.com on 5 Oct 2010 at 7:18

GoogleCodeExporter commented 8 years ago
Just discovered that lowercase properties files won't work on App Engine. It is 
looking for en_US specifically. Which flavor of Linux are you using? I don't 
understand why your locale is defaulted to en_us instead of en_US.

Original comment by tlees...@gmail.com on 5 Oct 2010 at 7:46

GoogleCodeExporter commented 8 years ago
I also don't understand how you are about to get through the create account 
page with only en_US.properties and why it only fails when sending the e-mail.

Original comment by tlees...@gmail.com on 5 Oct 2010 at 7:48

GoogleCodeExporter commented 8 years ago
I'm running:

Ubuntu 10.04.1 LTS - x86_64 GNU/Linux

Original comment by chsnow...@gmail.com on 5 Oct 2010 at 5:50

GoogleCodeExporter commented 8 years ago
If you can find a fix a patch would be appreciated. It will probably be a while 
before I have a chance to setup an Ubuntu image w/ en_GB as the locale and see 
if I can reproduce it.

Original comment by tlees...@gmail.com on 5 Oct 2010 at 5:55

GoogleCodeExporter commented 8 years ago
I was able to reproduce this on Ubuntu 10.04.1 LTS - x86_64 with en_GB as the 
default system locale. Switching the system locale to en_US fixes the problem. 
However, this shouldn't be necessary. The problem is that when the locale is 
en_GB it looks for en_us.properties rather than en_US.properties.

Original comment by tlees...@gmail.com on 7 Oct 2010 at 7:02

GoogleCodeExporter commented 8 years ago

Original comment by tlees...@gmail.com on 8 Oct 2010 at 1:57

GoogleCodeExporter commented 8 years ago

Original comment by tlees...@gmail.com on 25 Oct 2010 at 2:22

GoogleCodeExporter commented 8 years ago
Fixed via 
https://github.com/tleese22/google-app-engine-jappstart/commit/9960090f07fe43270
de00f185e742ff4e8a66362

Chris - Please confirm.

Original comment by tlees...@gmail.com on 3 Nov 2010 at 7:25