AppEngine端点JsonMappingException - 避免要序列化字段 [英] AppEngine Endpoints JsonMappingException - Avoid field to be serialized

查看:151
本文介绍了AppEngine端点JsonMappingException - 避免要序列化字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到此错误:

 com.google.appengine.repackaged.org.codehaus.jackson.map.JsonMappingException: Direct self-reference leading to cycle

我一直试图避免该字段导致序列化但是错误未得到纠正。
我试图把@JsonIgnore放在任何地方,包括getter,setter,属性以及每种可能的组合。

I have been trying to avoid the field causing this to be serialized but the error is not corrected. I have tried to put @JsonIgnore everywhere, in the getter, the setter, the attribute and every possible combination of those.

谢谢

- >编辑

我无法导入com.google.appengine.repackaged.org.codehaus.jackson.annotate.JsonIgnoreProperties ,它说使用com.google.appengine.repackaged可能会导致您的应用在没有警告的情况下中断。所以我导入了org.codehaus.jackson.annotate.JsonIgnoreProperties。

I can't import com.google.appengine.repackaged.org.codehaus.jackson.annotate.JsonIgnoreProperties, it says that "Use of com.google.appengine.repackaged may result in your app breaking without warning.". So I import org.codehaus.jackson.annotate.JsonIgnoreProperties instead.

在重新打包的包中抛出异常(我无法导入的)。这就是为什么我的JsonIgnore无法工作?

The exception is thrown in the repackaged package (the one I cant import). Is that why my JsonIgnore is not working??

再次感谢。

推荐答案

我找到了解决方案。我将整个包放在注释中。

I found the solution. I put the entire package in the annotation.

@com.google.appengine.repackaged.org.codehaus.jackson.annotate.JsonIgnoreProperties({"users"})
public class MyClass extends MySuperClass{
    ....
}

这样Eclipse就不会给我这个错误:使用com.google.appengine.repackaged可能会导致你的应用程序在没有警告的情况下破坏,一切正常。

This way Eclipse doesn't gives me this error: Use of com.google.appengine.repackaged may result in your app breaking without warning and everything worked fine.

这篇关于AppEngine端点JsonMappingException - 避免要序列化字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆