How to use the GAECache with Play-1.1 ?

59 views
Skip to first unread message

Takuya UESHIN

unread,
Jan 2, 2011, 12:14:55 PM1/2/11
to play-fr...@googlegroups.com
Hi.

I mentioned that the GAECache might not be used by Play-1.1 with gae-module.
I tried using Cache without the scala-module but the problem was also occurred.


I believe the Cache should be initialized after Cache.forcedCacheImpl is set.
But now the initialization sequence is in the inverse order.

Therefore Play should be changed the initialize sequence,
or the gae-module should be changed to set the Cache.forcedCacheImpl
before Cache is initialized.


What do you think about that?
Or please let me know if I made mistakes.

Regards.

Takuya UESHIN

2010/12/29 Takuya UESHIN <ues...@happy-camper.st>:
> Hi, Guillaume.
>
> I tried to merge the difference into a current version of the scala module.
> And it works on Google AppEngine.
>
> Thank you very much!
>
>
> But I found another problem.
>
> Play! 1.1 use not the GAECache but the EhCacheImpl.
> This problem might be caused by the modification pointed below.
>
> https://github.com/playframework/play/commit/6edac345a4655b7e181943e078b3a58d1be3314c
>
>
> Or, should I configure something when I want to use the GAECache
> instead of the EhCacheImpl?
>
>
> Thanks.
>
> Takuya UESHIN
>
>
> 2010/12/29 Guillaume Bort <guillau...@gmail.com>:
>> Ok, it's fixed in the scala module GitHub master. Tried with this
>> sample application that use a 10s cache:
>>
>> http://playgae.appspot.com/
>>
>> On Tue, Dec 28, 2010 at 5:16 PM, Takuya UESHIN <ues...@happy-camper.st> wrote:
>>> Hi, Guillaume.
>>>
>>> It seems a constructor of ScalaCache starts Actor.
>>> GAE restricts making threads.
>>>
>>> Here is the stacktrace.
>>>
>>>
>>> Execution exception
>>> ExceptionInInitializerError occured : null
>>>
>>> play.exceptions.JavaExecutionException
>>>        at play.mvc.ActionInvoker.invoke(ActionInvoker.java:285)
>>>        at play.server.ServletWrapper$ServletInvocation.execute(ServletWrapper.java:472)
>>>        at play.Invoker$Invocation.run(Invoker.java:187)
>>>        at play.server.ServletWrapper$ServletInvocation.run(ServletWrapper.java:463)
>>>        at play.Invoker.invokeInThread(Invoker.java:61)
>>>        at play.server.ServletWrapper.service(ServletWrapper.java:113)
>>>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>>>        at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
>>>        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
>>>        at com.google.apphosting.utils.servlet.ParseBlobUploadFilter.doFilter(ParseBlobUploadFilter.java:97)
>>>        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
>>>        at com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter(SaveSessionFilter.java:35)
>>>        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 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.runtime.jetty.AppVersionHandlerMap.handle(AppVersionHandlerMap.java:238)
>>>        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.headerComplete(HttpConnection.java:923)
>>>        at com.google.apphosting.runtime.jetty.RpcRequestParser.parseAvailable(RpcRequestParser.java:76)
>>>        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
>>>        at com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:135)
>>>        at com.google.apphosting.runtime.JavaRuntime.handleRequest(JavaRuntime.java:261)
>>>        at com.google.apphosting.base.RuntimePb$EvaluationRuntime$6.handleBlockingRequest(RuntimePb.java:8495)
>>>        at com.google.apphosting.base.RuntimePb$EvaluationRuntime$6.handleBlockingRequest(RuntimePb.java:8493)
>>>        at com.google.net.rpc.impl.BlockingApplicationHandler.handleRequest(BlockingApplicationHandler.java:24)
>>>        at com.google.net.rpc.impl.RpcUtil.runRpcInApplication(RpcUtil.java:435)
>>>        at com.google.net.rpc.impl.Server$RpcTask.runInContext(Server.java:572)
>>>        at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:448)
>>>        at com.google.tracing.TraceContext.runInContext(TraceContext.java:688)
>>>        at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:326)
>>>        at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:318)
>>>        at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:446)
>>>        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
>>>        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
>>>        at java.lang.Thread.run(Thread.java:636)
>>> Caused by: java.lang.ExceptionInInitializerError
>>>        at play.cache.ScalaCache$.<init>(ScalaCache.scala:16)
>>>        at play.cache.ScalaCache$.<clinit>(ScalaCache.scala)
>>>        at play.cache.package$.<init>(package.scala:6)
>>>        at play.cache.package$.<clinit>(package.scala)
>>>        at models.User$.get(app/models/User.scala:41)
>>>        at controllers.Application$$anonfun$1.apply(app/controllers/Application.scala:54)
>>>        at controllers.Application$$anonfun$1.apply(app/controllers/Application.scala:54)
>>>        at controllers.Application$.followings(app/controllers/Application.scala:54)
>>>        at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:420)
>>>        at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:403)
>>>        at play.mvc.ActionInvoker.invoke(ActionInvoker.java:176)
>>>        at play.server.ServletWrapper$ServletInvocation.execute(ServletWrapper.java:472)
>>>        at play.Invoker$Invocation.run(Invoker.java:187)
>>>        at play.server.ServletWrapper$ServletInvocation.run(ServletWrapper.java:463)
>>>        at play.Invoker.invokeInThread(Invoker.java:61)
>>>        at play.server.ServletWrapper.service(ServletWrapper.java:113)
>>>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>>>        at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
>>>        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
>>>        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
>>>        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
>>>        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 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.headerComplete(HttpConnection.java:923)
>>>        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
>>>        ... 11 more
>>> Caused by: java.security.AccessControlException: access denied
>>> (java.lang.RuntimePermission modifyThreadGroup)
>>>        at java.security.AccessControlContext.checkPermission(AccessControlContext.java:355)
>>>        at java.security.AccessController.checkPermission(AccessController.java:567)
>>>        at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
>>>        at java.lang.ThreadGroup.checkAccess(ThreadGroup.java:304)
>>>        at java.lang.Thread.init(Thread.java:349)
>>>        at java.lang.Thread.<init>(Thread.java:394)
>>>        at java.util.TimerThread.<init>(Timer.java:478)
>>>        at java.util.Timer.<init>(Timer.java:100)
>>>        at java.util.Timer.<init>(Timer.java:146)
>>>        at scala.actors.Actor$.<init>(Actor.scala:56)
>>>        at scala.actors.Actor$.<clinit>(Actor.scala)
>>>        ... 43 more
>>>
>>>
>>> Thanks.
>>>
>>> Takuya UESHIN
>>>
>>>
>>> 2010/12/29 Guillaume Bort <guillau...@gmail.com>:
>>>> The Actor is not required, but I guess that GAE restrict this class to
>>>> load because of imports? Can you show the stacktrace?
>>>>
>>>> On Tue, Dec 28, 2010 at 4:40 PM, Takuya UESHIN <ues...@happy-camper.st> wrote:
>>>>> Hello.
>>>>>
>>>>> I'm using Play! with scala-module on Google AppEngine (gae-module).
>>>>> But Cache doesn't work because ScalaCache is using Actor.
>>>>>
>>>>> Do you have any ideas to make it work properly?
>>>>>
>>>>> Play 1.1
>>>>> - scala-0.8
>>>>> - gae-1.4
>>>>> - siena-1.3
>>>>>
>>>>> Thanks for your help.
>>>>>
>>>>> Regards,
>>>>>
>>>>> Takuya UESHIN
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google Groups "play-framework" group.
>>>>> To post to this group, send email to play-fr...@googlegroups.com.
>>>>> To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
>>>>> For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Guillaume Bort, http://guillaume.bort.fr
>>>>
>>>> For anything work-related, use g...@zenexity.fr; for everything else,
>>>> write guillau...@gmail.com
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google Groups "play-framework" group.
>>>> To post to this group, send email to play-fr...@googlegroups.com.
>>>> To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
>>>> For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.
>>>>
>>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups "play-framework" group.
>>> To post to this group, send email to play-fr...@googlegroups.com.
>>> To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
>>> For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.
>>>
>>>
>>
>>
>>
>> --
>> Guillaume Bort, http://guillaume.bort.fr
>>
>> For anything work-related, use g...@zenexity.fr; for everything else,
>> write guillau...@gmail.com
>>
>> --
>> You received this message because you are subscribed to the Google Groups "play-framework" group.
>> To post to this group, send email to play-fr...@googlegroups.com.
>> To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
>> For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.
>>
>>
>

Jean-Philippe Briend

unread,
Jan 3, 2011, 5:21:09 AM1/3/11
to play-fr...@googlegroups.com
Hi,
Do not forget to do a Cache.init() at the beginning of your application.
That was my problem why my GAE app was not using memcached.

Jean-Philippe.

Guillaume Bort

unread,
Jan 3, 2011, 10:29:32 AM1/3/11
to play-fr...@googlegroups.com
Yes you are right. I don't remember exactly why the initialization
sequence has changed in play 1.1. I will try to fix it ASAP. Have you
reported the issue already?

Takuya UESHIN

unread,
Jan 3, 2011, 10:54:18 AM1/3/11
to play-fr...@googlegroups.com
Hi, Guillaume.

I'm afraid I don't know how to report the issue.
Could you tell me the way?

Thanks.

Takuya UESHIN


2011/1/4 Guillaume Bort <guillau...@gmail.com>:

Guillaume Bort

unread,
Jan 3, 2011, 11:00:56 AM1/3/11
to play-fr...@googlegroups.com

Jean-Philippe Briend

unread,
Jan 4, 2011, 10:44:22 AM1/4/11
to play-fr...@googlegroups.com

Takuya UESHIN

unread,
Jan 4, 2011, 11:22:28 AM1/4/11
to play-fr...@googlegroups.com
Hi, Jean-Philippe.

I really appreciate your writing!

Takuya UESHIN


2011/1/5 Jean-Philippe Briend <jeanphili...@gmail.com>:
> Done
> : http://play.lighthouseapp.com/projects/57987-play-framework/tickets/527-gae-cache-not-initialized

Reply all
Reply to author
Forward
0 new messages