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

Showing 1-9 of 9 messages
Re: [objectify-appengine] Cloud endpoints .api generation exception when using objectify (4.0b1) parameterized key Jeff Schnitzer 11/25/12 2:03 PM
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.

Re: [objectify-appengine] Cloud endpoints .api generation exception when using objectify (4.0b1) parameterized key RyanZA 11/25/12 11:56 PM
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...
Re: [objectify-appengine] Cloud endpoints .api generation exception when using objectify (4.0b1) parameterized key Jeff Schnitzer 11/26/12 8:51 AM
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
Re: Cloud endpoints .api generation exception when using objectify (4.0b1) parameterized key Riccardo Tommasini 2/20/14 3:05 AM
Hi guys, have you found any solution for the problem you shown ?
Re: Cloud endpoints .api generation exception when using objectify (4.0b1) parameterized key Zsolt Márta 3/9/14 12:18 PM
Yeah, any update on this one? For example a sample code for a Transformer to serialize the Key?
Re: [objectify-appengine] Re: Cloud endpoints .api generation exception when using objectify (4.0b1) parameterized key Jeff Schnitzer 3/9/14 12:58 PM
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-appengine+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Re: Cloud endpoints .api generation exception when using objectify (4.0b1) parameterized key Ashish Awasthi 3/16/14 7:25 AM
For people still hitting this post, Mr. Holevoet has answered this at: 
Re: [objectify-appengine] Re: Cloud endpoints .api generation exception when using objectify (4.0b1) parameterized key Jeff Schnitzer 3/18/14 9:09 PM
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
Re: [objectify-appengine] Re: Cloud endpoints .api generation exception when using objectify (4.0b1) parameterized key Zsolt Márta 3/31/14 10:48 AM
That would be great, Jeff!

@Ashish: Unfortunately, Mr. Holevoet hasn't shared any transformer code with us.