0

I have a AppEngine project that is served using Google Cloud EndPoints.

Some of the Request and Response objects (which I have no control over) have no attributes.

When those endpoints are invoked the call will fail with:

com.google.api.server.spi.handlers.EndpointsMethodHandler$RestHandler handle: exception occurred while invoking backend method
com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class au.com.xandar.wylas.licence.endpoint.response.SendUserInviteResponse and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS)

Normally I would just get the ObjectMapper on instance startup and call

objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);

But I am struggling to work out how to get hold of the ObjectMapper that AppEngine is using.

And note:

  • I am not using Spring
  • I am not using Guice

I do not want to introduce either of these frameworks into the mix.

How can can I retrieve the ObjectMapper that AppEngine is using so that I can modify it's config?

William
  • 20,150
  • 8
  • 49
  • 91
  • Searching for a while I found this [post](https://stackoverflow.com/questions/42327779/configure-jackson-for-google-app-engine) that might help you with your issue, hopes this solve the problem. note the comment in the response, there may be the help that you need [1]: https://stackoverflow.com/questions/42327779/configure-jackson-for-google-app-engine – Robertocd_98 Jun 07 '21 at 09:57
  • Thanks @Robertocd_98 but I had already seen that post and tried all those options to no avail. – William Jun 12 '21 at 03:31
  • After reading the error that you are getting more carefully I noticed that one of the error says "to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS" and after searching for a while I fond this [post](https://stackoverflow.com/questions/15261456/how-do-i-disable-fail-on-empty-beans-in-jackson) that could help you do what the error recommend. – Robertocd_98 Jun 16 '21 at 13:34
  • Yes @Robertocd_98 I had seen that too. But to make use of that I would need to be able to construct the ObjectMapper that Endpoints is using. – William Jun 18 '21 at 01:15
  • App Engine does not surface an ObjectMapper object. Could you provide some more context on your implementation so we can have a better understanding of the issue? I found some posts in google groups and so that may be helpful to your issue which basically says that this may be related to the Open API spec : [1] https://groups.google.com/g/google-cloud-endpoints/c/Sv9rMUs3V7E [2] https://groups.google.com/g/google-cloud-endpoints/c/BlgiuUDODYc [3] https://stackoverflow.com/questions/42749021/google-cloud-endpoints-firebase-auth-method-info-is-not-set – drauedo Jul 07 '21 at 07:45

0 Answers0