Re: [objectify-appengine] Cloud endpoints .api generation exception when using objectify (4.0b1) parameterized key

1,231 views
Skip to first unread message

Jeff Schnitzer

unread,
Nov 25, 2012, 5:03:45 PM11/25/12
to objectify...@googlegroups.com
What does cloud endpoints need to serialize arbitrary objects?  Is there any documentation?  I'm not volunteering to delve into the inner workings of yet another RPC implementation, but if there's something I can do to make Key compatible, let me know.

Why does "cloud endpoints" even exist?  Does the internet need yet another proprietary, non-portable RPC protocol?

Jeff


On Sun, Nov 25, 2012 at 2:09 PM, James Moore <james...@gmail.com> wrote:
I had a successfully working service using cloud endpoints that was originally developed using JDO.  When switching the entities to Objectify there was a problem where the .api file kept being removed from the project, resulting in a 404 error for every request.

Looking at the eclipse logs shows a problem with generating the api when using a parameterized objectify key (stack trace shown below):

!ENTRY com.google.gdt.eclipse.appengine.swarm 4 0 2012-11-24 19:53:51.700
!MESSAGE Unexpected Exception
!STACK 0
java.lang.reflect.InvocationTargetException
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.gdt.eclipse.appengine.swarm.wizards.helpers.SwarmApiCreator.createSwarmApi(SwarmApiCreator.java:96)
at com.google.gdt.eclipse.appengine.swarm.wizards.helpers.SwarmServiceCreator.create(SwarmServiceCreator.java:192)
at com.google.gdt.eclipse.appengine.swarm.wizards.HandleGaeProjectChange.gaeProjectRebuilt(HandleGaeProjectChange.java:64)
at com.google.appengine.eclipse.core.properties.ui.GaeProjectChangeNotifier.build(GaeProjectChangeNotifier.java:77)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374)
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Caused by: java.lang.IllegalArgumentException: Parameterized type class com.googlecode.objectify.Key not supported.
at com.google.api.server.spi.tools.AnnotationApiConfigGenerator.addClassToSchema(AnnotationApiConfigGenerator.java:653)
at com.google.api.server.spi.tools.AnnotationApiConfigGenerator.addTypeToSchema(AnnotationApiConfigGenerator.java:588)
at com.google.api.server.spi.tools.AnnotationApiConfigGenerator.addBeanProperties(AnnotationApiConfigGenerator.java:694)
at com.google.api.server.spi.tools.AnnotationApiConfigGenerator.addBeanTypeToSchema(AnnotationApiConfigGenerator.java:621)
at com.google.api.server.spi.tools.AnnotationApiConfigGenerator.addTypeToSchema(AnnotationApiConfigGenerator.java:607)
at com.google.api.server.spi.tools.AnnotationApiConfigGenerator.addItemTypeToSchema(AnnotationApiConfigGenerator.java:559)
at com.google.api.server.spi.tools.AnnotationApiConfigGenerator.convertMethodResponse(AnnotationApiConfigGenerator.java:514)
at com.google.api.server.spi.tools.AnnotationApiConfigGenerator.convertApiMethod(AnnotationApiConfigGenerator.java:415)
at com.google.api.server.spi.tools.AnnotationApiConfigGenerator.convertApiMethods(AnnotationApiConfigGenerator.java:377)
at com.google.api.server.spi.tools.AnnotationApiConfigGenerator.convertApiMethods(AnnotationApiConfigGenerator.java:362)
at com.google.api.server.spi.tools.AnnotationApiConfigGenerator.generateForService(AnnotationApiConfigGenerator.java:241)
at com.google.api.server.spi.tools.AnnotationApiConfigGenerator.generateConfigObjects(AnnotationApiConfigGenerator.java:218)
at com.google.api.server.spi.tools.AnnotationApiConfigGenerator.generateConfig(AnnotationApiConfigGenerator.java:181)
... 20 more

Removing the objectify keys allowed the .api file to generate successfully.

RyanZA

unread,
Nov 26, 2012, 2:56:23 AM11/26/12
to objectify...@googlegroups.com, je...@infohazard.org
Looks really interesting, actually. It generates JSON/REST by default off of POJOs... pretty impressive. So it's not entirely proprietary/non-portable.
Can check it out here:
http://greenido.wordpress.com/2012/07/07/html5-modern-web-app-and-google-cloud-endpoints/

Seems to be similar to going the Jersey/REST route, but it takes out a lot of boilerplate code, such as creating @GET, @POST etc. Probably good for getting small, multiplatform apps up and running as quickly as possible? If made well enough with enough useful tools to allow for edge cases, it could become some very impressive tech...

Jeff Schnitzer

unread,
Nov 26, 2012, 11:51:43 AM11/26/12
to objectify...@googlegroups.com
I'm having a hard time seeing what is gained beyond JAXRS or some other equivalent library.  Perhaps Cloud Endpoints has better syntax than JAXRS (which wouldn't be hard, all things considered), but it's implemented as a service inside Google. Which means not only is this closed-source, it's 100% opaque and out of your control. Bump into a limitation? You are hosed. And you can't port this to another platform.

Case in point - this service blows up trying to serialize Ref<?>.  How do you fix it?  How do you customize serialization of other classes?  Where's the equivalent of Jackson's extensive annotations and configuration?  Right now the OP is hosed. It's entirely possible that there is no fix.

If Google had offered this as an opensource library I'd be shouting praise from the rooftops. But right now it looks more like the Channel API - and I don't know anyone who has used the Channel API who doesn't seriously regret it.

Jeff

Riccardo Tommasini

unread,
Feb 20, 2014, 6:05:54 AM2/20/14
to objectify...@googlegroups.com
Hi guys, have you found any solution for the problem you shown ?

Zsolt Márta

unread,
Mar 9, 2014, 3:18:07 PM3/9/14
to objectify...@googlegroups.com
Yeah, any update on this one? For example a sample code for a Transformer to serialize the Key?

Jeff Schnitzer

unread,
Mar 9, 2014, 3:58:00 PM3/9/14
to objectify...@googlegroups.com
This is really a question for the Cloud Endpoints community. You're
asking "how do you serialize a custom object with the Cloud Endpoints
API"; it could be any third-party class. This mailing list has a lot
of Objectify experts but (apparently) no experts on Cloud Endpoints,
so the question goes unanswered here.

Jeff
> --
> You received this message because you are subscribed to the Google Groups
> "objectify-appengine" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to objectify-appen...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Ashish Awasthi

unread,
Mar 16, 2014, 10:25:35 AM3/16/14
to objectify...@googlegroups.com
For people still hitting this post, Mr. Holevoet has answered this at: 

Jeff Schnitzer

unread,
Mar 19, 2014, 12:09:37 AM3/19/14
to objectify...@googlegroups.com
FWIW, if someone can come up with a PR that includes the relevant
Cloud Endpoints transformer code, I'm happy to ship it with the
Objectify jar in the same way we include the GWT custom serializers.

Jeff

Zsolt Márta

unread,
Mar 31, 2014, 1:48:30 PM3/31/14
to objectify...@googlegroups.com, je...@infohazard.org
That would be great, Jeff!

@Ashish: Unfortunately, Mr. Holevoet hasn't shared any transformer code with us.
Reply all
Reply to author
Forward
0 new messages