John, I think my earlier serialization error problems in production were because I was unnwittingly using an old version of GAE (1.2.6). Vince was never able to reproduce the issue in production. I believe everything is working in dev and prod as of 1.2.8. Give it a whirl and post your feedback.
/dmc http://turbomanage.wordpress.com On Jan 1, 1:42 am, John Howe <jhowe...@gmail.com> wrote: > I greatly appreciate the work that has been done here. But let me ask my > question another way. Is it known that this does not work? > > On Thu, Dec 31, 2009 at 5:19 PM, John Howe <jhowe...@gmail.com> wrote: > > I can't seem to find any additional postings on this topic and I'm not > > sure what the conclusion for being able to use the Deferred capability > > with the latest Java SDK release. I'm just wondering if Vince's > > solution works on both server and development environments. > > > On Dec 16, 10:42 am, David Chandler <turboman...@gmail.com> wrote: > > > Thanks, Vince. > > > > Regarding a way to access the Guice injector, I've figured out I can > > > simply create and access the injector via a static factory, so no > > > changes are needed to Deferred or Deferrable. This works for AppEngine > > > since there is only one WAR per JVM. If there were more than web app, > > > I'm not sure whether Guice ServletModules would work, but that's not > > > an issue for now. > > > > /dmchttp://turbomanage.wordpress.com > > > > On Dec 2, 2:47 pm, Vince Bonfanti <vbonfa...@gmail.com> wrote: > > > > > The behavior you're reporting is exactly the opposite of what I'm > > seeing. > > > > For me, deserialization always fails on the dev server and always works > > in > > > > production. What I'm seeing on the dev server is that the bytes > > retrieved > > > > from the task payload (req.getInputStream) are not the same bytes that > > are > > > > sent; the result is the StreamCorruptedException. Again, though, I only > > see > > > > this on the dev server and never in production. Can you send me an > > example > > > > that fails in production? I'd like to understand what's going on before > > > > applying the Base64 encoder workaround. > > > > > I'm not at all familiar with Guice, but I think I understand what > > you're > > > > trying to do. One thought I've had is that we could pass the > > > > HttpServletRequest object to the doTask() method. This would allow you > > to > > > > add attributes (objects) to the HttpServletRequest within your Guice > > filter > > > > and then retrieve them within your doTask() method. > > > > > Vince > > > > > On Fri, Nov 27, 2009 at 7:53 PM, David Chandler <turboman...@gmail.com > > >wrote: > > > > > > I've solved the serialization problems by Base64 encoding the > > > > > serialized task before calling payload() and decoding it in the > > > > > deserialize(HttpServletRequest) method. I'm guessing something in the > > > > > task queue chain (either task queue payload storage or the servlet > > > > > call when task is run) has problems transmitting the binary data, as > > > > > the exception I was getting at one point was a > > > > > java.io.StreamCorruptedException. > > > > > > I'll send another patch to Vince. My solution works, but I'm not > > > > > completely satisfied that I've diagnosed the problem correctly. I > > used > > > > > Apache commons-codec for Base64. Is it safe to use com.sun.misc > > > > > instead? I see it in appengine.repackaged chain, as well, but don't > > > > > see it as part of an official Google API. > > > > > > Somewhat related, I've wired up the Deferred servlet through the > > > > > GuiceFilter so I can pass a Guice injector to Deferrable tasks. Since > > > > > the task objects are not created through Guice, but rather by > > > > > deserializing, I modified doTask() to accept an additional Injector > > > > > argument. We probably don't want that in the official version of > > > > > Deferrable, though. > > > > > > Is there a better way for my Deferrable classes to get access to a > > > > > Guice "context"? I'm trying to avoid Guice.createInjector(), as it > > > > > results in a duplicate PersistenceManagerFactory being created since > > > > > other servlets are also being served through Guice. > > > > > > Thank you, > > > > > /dmc > > > > > > On Nov 27, 5:42 pm, David Chandler <turboman...@gmail.com> wrote: > > > > > > Jeff, > > > > > > > I'm seeing problems with deserialization, too, when deployed on > > > > > > AppEngine. In dev, I can deserialize(serialize(task)) and it works > > > > > > just fine, but not so in AppEngine. I get the same error whether > > the > > > > > > task payload is the serialized Deferrable task itself or just the > > Key > > > > > > with the task in the db, but I haven't yet figured out which is the > > > > > > cause of the problem. > > > > > > > The error I'm getting on AppEngine is invalid type code: 00 in > > > > > > Deferred.deserialize method. I've tried Base64 encoding after > > > > > > serialization in case it's related to special binary escape > > sequences > > > > > > that happen to be in the serialized object stream but still no > > > > > > success. > > > > > > > I'm pretty sure AppEngine has written some custom code to do > > > > > > serialization because I previously got an AppEngine acess control > > > > > > exception when calling enableResolveObject(true) in a subclass of > > > > > > ObjectInputStream, and I'm wondering if that's in play somehow... > > > > > > > /dmc > > > -- > > > You received this message because you are subscribed to the Google Groups > > "Google App Engine for Java" group. > > To post to this group, send email to > > google-appengine-j...@googlegroups.com. > > To unsubscribe from this group, send email to > > google-appengine-java+unsubscr...@googlegroups.com<google-appengine-java%2bunsubscr...@googlegroups.com> > > . > > For more options, visit this group at > >http://groups.google.com/group/google-appengine-java?hl=en. -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.