Json serialization errors caused by json serialization loop reference

Source: Internet
Author: User
Tags tojson

Json serialization errors caused by json serialization loop reference

The following error message is displayed:

Caused by: java. lang. IllegalStateException: circular reference error
Offending field: methodAccessor

Offending object: preserveType: false, type: interface sun. reflect. MethodAccessor, obj: sun. reflect. DelegatingMethodAccessorImpl @ 5886f7bf
At com. google. gson. CircularReferenceException. createDetailedException (CircularReferenceException. java: 43)
At com. google. gson. JsonSerializationVisitor. visitObjectField (JsonSerializationVisitor. java: 115)
At com. google. gson. ObjectNavigator. navigateClassFields (ObjectNavigator. java: 164)
At com. google. gson. ObjectNavigator. accept (ObjectNavigator. java: 131)
At com. google. gson. JsonSerializationVisitor. getJsonElementForChild (JsonSerializationVisitor. java: 147)
At com. google. gson. JsonSerializationVisitor. addAsChildOfObject (JsonSerializationVisitor. java: 125)
At com. google. gson. JsonSerializationVisitor. visitObjectField (JsonSerializationVisitor. java: 112)
At com. google. gson. ObjectNavigator. navigateClassFields (ObjectNavigator. java: 164)
At com. google. gson. ObjectNavigator. accept (ObjectNavigator. java: 131)
At com. google. gson. JsonSerializationVisitor. getJsonElementForChild (JsonSerializationVisitor. java: 147)
At com. google. gson. JsonSerializationVisitor. addAsChildOfObject (JsonSerializationVisitor. java: 125)
At com. google. gson. JsonSerializationVisitor. visitObjectField (JsonSerializationVisitor. java: 112)
At com. google. gson. ObjectNavigator. navigateClassFields (ObjectNavigator. java: 164)
At com. google. gson. ObjectNavigator. accept (ObjectNavigator. java: 131)
At com. google. gson. JsonSerializationVisitor. getJsonElementForChild (JsonSerializationVisitor. java: 147)
At com. google. gson. JsonSerializationVisitor. addAsChildOfObject (JsonSerializationVisitor. java: 125)
At com. google. gson. JsonSerializationVisitor. visitObjectField (JsonSerializationVisitor. java: 112)
At com. google. gson. ObjectNavigator. navigateClassFields (ObjectNavigator. java: 164)
At com. google. gson. ObjectNavigator. accept (ObjectNavigator. java: 131)
At com. google. gson. JsonSerializationVisitor. getJsonElementForChild (JsonSerializationVisitor. java: 147)
At com. google. gson. JsonSerializationVisitor. addAsChildOfObject (JsonSerializationVisitor. java: 125)
At com. google. gson. JsonSerializationVisitor. visitObjectField (JsonSerializationVisitor. java: 112)
At com. google. gson. ObjectNavigator. navigateClassFields (ObjectNavigator. java: 164)
At com. google. gson. ObjectNavigator. accept (ObjectNavigator. java: 131)
At com. google. gson. JsonSerializationVisitor. getJsonElementForChild (JsonSerializationVisitor. java: 147)
At com. google. gson. JsonSerializationVisitor. addAsChildOfObject (JsonSerializationVisitor. java: 125)
At com. google. gson. JsonSerializationVisitor. visitObjectField (JsonSerializationVisitor. java: 112)
At com. google. gson. ObjectNavigator. navigateClassFields (ObjectNavigator. java: 164)
At com. google. gson. ObjectNavigator. accept (ObjectNavigator. java: 131)
At com. google. gson. JsonSerializationVisitor. getJsonElementForChild (JsonSerializationVisitor. java: 147)
At com. google. gson. JsonSerializationVisitor. addAsChildOfObject (JsonSerializationVisitor. java: 125)
At com. google. gson. JsonSerializationVisitor. visitObjectField (JsonSerializationVisitor. java: 112)
At com. google. gson. ObjectNavigator. navigateClassFields (ObjectNavigator. java: 164)
At com. google. gson. ObjectNavigator. accept (ObjectNavigator. java: 131)
At com. google. gson. JsonSerializationVisitor. getJsonElementForChild (JsonSerializationVisitor. java: 147)
At com. google. gson. JsonSerializationVisitor. addAsChildOfObject (JsonSerializationVisitor. java: 125)
At com. google. gson. JsonSerializationVisitor. visitObjectField (JsonSerializationVisitor. java: 112)
At com. google. gson. ObjectNavigator. navigateClassFields (ObjectNavigator. java: 164)
At com. google. gson. ObjectNavigator. accept (ObjectNavigator. java: 131)
At com. google. gson. JsonSerializationContextDefault. serialize (JsonSerializationContextDefault. java: 56)
At com. google. gson. Gson. toJsonTree (Gson. java: 233)
At com. google. gson. Gson. toJson (Gson. java: 273)
At com. google. gson. Gson. toJson (Gson. java: 253)
At com. htsoft. oa. action. structuringdatamanage. TableargAction. get (TableargAction. java: 142)
At sun. reflect. NativeMethodAccessorImpl. invoke0 (Native Method)
At sun. reflect. NativeMethodAccessorImpl. invoke (NativeMethodAccessorImpl. java: 57)
At sun. reflect. DelegatingMethodAccessorImpl. invoke (DelegatingMethodAccessorImpl. java: 43)
At java. lang. reflect. Method. invoke (Method. java: 606)
At com. opensymphony. xwork2.defaactionactioninvocation. invokeAction (DefaultActionInvocation. java: 404)
At com. opensymphony. xwork2.DefaultActionInvocation. invokeActionOnly (DefaultActionInvocation. java: 267)
At com. opensymphony. xwork2.defaactionactioninvocation. invoke (defaactionactioninvocation. java: 229)
At com. opensymphony. xwork2.interceptor. DefaultWorkflowInterceptor. doIntercept (defaworkworkflowinterceptor. java: 221)
At com. opensymphony. xwork2.interceptor. MethodFilterInterceptor. intercept (MethodFilterInterceptor. java: 86)
At com. opensymphony. xwork2.DefaultActionInvocation $2. doProfiling (DefaultActionInvocation. java: 224)
At com. opensymphony. xwork2.DefaultActionInvocation $2. doProfiling (DefaultActionInvocation. java: 223)
At com. opensymphony. xwork2.util. profiling. UtilTimerStack. profile (UtilTimerStack. java: 455)
At com. opensymphony. xwork2.defaactionactioninvocation. invoke (defaactionactioninvocation. java: 221)
At com. opensymphony. xwork2.validator. ValidationInterceptor. doIntercept (ValidationInterceptor. java: 150)
At org. apache. struts2.interceptor. validation. AnnotationValidationInterceptor. doIntercept (AnnotationValidationInterceptor. java: 48)
At com. opensymphony. xwork2.interceptor. MethodFilterInterceptor. intercept (MethodFilterInterceptor. java: 86)
At com. opensymphony. xwork2.DefaultActionInvocation $2. doProfiling (DefaultActionInvocation. java: 224)
At com. opensymphony. xwork2.DefaultActionInvocation $2. doProfiling (DefaultActionInvocation. java: 223)
At com. opensymphony. xwork2.util. profiling. UtilTimerStack. profile (UtilTimerStack. java: 455)
At com. opensymphony. xwork2.defaactionactioninvocation. invoke (defaactionactioninvocation. java: 221)
At com. opensymphony. xwork2.interceptor. ConversionErrorInterceptor. intercept (ConversionErrorInterceptor. java: 123)
At com. opensymphony. xwork2.DefaultActionInvocation $2. doProfiling (DefaultActionInvocation. java: 224)
At com. opensymphony. xwork2.DefaultActionInvocation $2. doProfiling (DefaultActionInvocation. java: 223)
At com. opensymphony. xwork2.util. profiling. UtilTimerStack. profile (UtilTimerStack. java: 455)
At com. opensymphony. xwork2.defaactionactioninvocation. invoke (defaactionactioninvocation. java: 221)
At com. opensymphony. xwork2.interceptor. ParametersInterceptor. doIntercept (ParametersInterceptor. java: 184)
At com. opensymphony. xwork2.interceptor. MethodFilterInterceptor. intercept (MethodFilterInterceptor. java: 86)
At com. opensymphony. xwork2.DefaultActionInvocation $2. doProfiling (DefaultActionInvocation. java: 224)
At com. opensymphony. xwork2.DefaultActionInvocation $2. doProfiling (DefaultActionInvocation. java: 223)
At com. opensymphony. xwork2.util. profiling. UtilTimerStack. profile (UtilTimerStack. java: 455)
At com. opensymphony. xwork2.defaactionactioninvocation. invoke (defaactionactioninvocation. java: 221)
At com. opensymphony. xwork2.interceptor. StaticParametersInterceptor. intercept (StaticParametersInterceptor. java: 105)
At com. opensymphony. xwork2.DefaultActionInvocation $2. doProfiling (DefaultActionInvocation. java: 224)
At com. opensymphony. xwork2.DefaultActionInvocation $2. doProfiling (DefaultActionInvocation. java: 223)
At com. opensymphony. xwork2.util. profiling. UtilTimerStack. profile (UtilTimerStack. java: 455)
At com. opensymphony. xwork2.defaactionactioninvocation. invoke (defaactionactioninvocation. java: 221)
At org. apache. struts2.interceptor. CheckboxInterceptor. intercept (CheckboxInterceptor. java: 83)
At com. opensymphony. xwork2.DefaultActionInvocation $2. doProfiling (DefaultActionInvocation. java: 224)
At com. opensymphony. xwork2.DefaultActionInvocation $2. doProfiling (DefaultActionInvocation. java: 223)
At com. opensymphony. xwork2.util. profiling. UtilTimerStack. profile (UtilTimerStack. java: 455)
At com. opensymphony. xwork2.defaactionactioninvocation. invoke (defaactionactioninvocation. java: 221)
At org. apache. struts2.interceptor. FileUploadInterceptor. intercept (FileUploadInterceptor. java: 207)
At com. opensymphony. xwork2.DefaultActionInvocation $2. doProfiling (DefaultActionInvocation. java: 224)
At com. opensymphony. xwork2.DefaultActionInvocation $2. doProfiling (DefaultActionInvocation. java: 223)
At com. opensymphony. xwork2.util. profiling. UtilTimerStack. profile (UtilTimerStack. java: 455)
At com. opensymphony. xwork2.defaactionactioninvocation. invoke (defaactionactioninvocation. java: 221)
At com. opensymphony. xwork2.interceptor. ModelDrivenInterceptor. intercept (ModelDrivenInterceptor. java: 74)
At com. opensymphony. xwork2.DefaultActionInvocation $2. doProfiling (DefaultActionInvocation. java: 224)
At com. opensymphony. xwork2.DefaultActionInvocation $2. doProfiling (DefaultActionInvocation. java: 223)
At com. opensymphony. xwork2.util. profiling. UtilTimerStack. profile (UtilTimerStack. java: 455)
At com. opensymphony. xwork2.defaactionactioninvocation. invoke (defaactionactioninvocation. java: 221)
At com. opensymphony. xwork2.interceptor. ScopedModelDrivenInterceptor. intercept (ScopedModelDrivenInterceptor. java: 127)
At com. opensymphony. xwork2.DefaultActionInvocation $2. doProfiling (DefaultActionInvocation. java: 224)
At com. opensymphony. xwork2.DefaultActionInvocation $2. doProfiling (DefaultActionInvocation. java: 223)
At com. opensymphony. xwork2.util. profiling. UtilTimerStack. profile (UtilTimerStack. java: 455)
At com. opensymphony. xwork2.defaactionactioninvocation. invoke (defaactionactioninvocation. java: 221)
At org. apache. struts2.interceptor. ProfilingActivationInterceptor. intercept (ProfilingActivationInterceptor. java: 107)
At com. opensymphony. xwork2.DefaultActionInvocation $2. doProfiling (DefaultActionInvocation. java: 224)
At com. opensymphony. xwork2.DefaultActionInvocation $2. doProfiling (DefaultActionInvocation. java: 223)
At com. opensymphony. xwork2.util. profiling. UtilTimerStack. profile (UtilTimerStack. java: 455)
At com. opensymphony. xwork2.defaactionactioninvocation. invoke (defaactionactioninvocation. java: 221)
At org. apache. struts2.interceptor. debugging. DebuggingInterceptor. intercept (DebuggingInterceptor. java: 206)
At com. opensymphony. xwork2.DefaultActionInvocation $2. doProfiling (DefaultActionInvocation. java: 224)
At com. opensymphony. xwork2.DefaultActionInvocation $2. doProfiling (DefaultActionInvocation. java: 223)
At com. opensymphony. xwork2.util. profiling. UtilTimerStack. profile (UtilTimerStack. java: 455)
At com. opensymphony. xwork2.defaactionactioninvocation. invoke (defaactionactioninvocation. java: 221)
At com. opensymphony. xwork2.interceptor. ChainingInterceptor. intercept (ChainingInterceptor. java: 115)
At com. opensymphony. xwork2.DefaultActionInvocation $2. doProfiling (DefaultActionInvocation. java: 224)
At com. opensymphony. xwork2.DefaultActionInvocation $2. doProfiling (DefaultActionInvocation. java: 223)
At com. opensymphony. xwork2.util. profiling. UtilTimerStack. profile (UtilTimerStack. java: 455)
At com. opensymphony. xwork2.defaactionactioninvocation. invoke (defaactionactioninvocation. java: 221)
At com. opensymphony. xwork2.interceptor. I18nInterceptor. intercept (I18nInterceptor. java: 143)
At com. opensymphony. xwork2.DefaultActionInvocation $2. doProfiling (DefaultActionInvocation. java: 224)
At com. opensymphony. xwork2.DefaultActionInvocation $2. doProfiling (DefaultActionInvocation. java: 223)
At com. opensymphony. xwork2.util. profiling. UtilTimerStack. profile (UtilTimerStack. java: 455)
At com. opensymphony. xwork2.defaactionactioninvocation. invoke (defaactionactioninvocation. java: 221)
At com. opensymphony. xwork2.interceptor. PrepareInterceptor. doIntercept (PrepareInterceptor. java: 121)
At com. opensymphony. xwork2.interceptor. MethodFilterInterceptor. intercept (MethodFilterInterceptor. java: 86)
At com. opensymphony. xwork2.DefaultActionInvocation $2. doProfiling (DefaultActionInvocation. java: 224)
At com. opensymphony. xwork2.DefaultActionInvocation $2. doProfiling (DefaultActionInvocation. java: 223)
At com. opensymphony. xwork2.util. profiling. UtilTimerStack. profile (UtilTimerStack. java: 455)
At com. opensymphony. xwork2.defaactionactioninvocation. invoke (defaactionactioninvocation. java: 221)
At org. apache. struts2.interceptor. ServletConfigInterceptor. intercept (ServletConfigInterceptor. java: 170)
At com. opensymphony. xwork2.DefaultActionInvocation $2. doProfiling (DefaultActionInvocation. java: 224)
At com. opensymphony. xwork2.DefaultActionInvocation $2. doProfiling (DefaultActionInvocation. java: 223)
At com. opensymphony. xwork2.util. profiling. UtilTimerStack. profile (UtilTimerStack. java: 455)
At com. opensymphony. xwork2.defaactionactioninvocation. invoke (defaactionactioninvocation. java: 221)
At com. opensymphony. xwork2.interceptor. AliasInterceptor. intercept (AliasInterceptor. java: 123)
At com. opensymphony. xwork2.DefaultActionInvocation $2. doProfiling (DefaultActionInvocation. java: 224)
At com. opensymphony. xwork2.DefaultActionInvocation $2. doProfiling (DefaultActionInvocation. java: 223)
At com. opensymphony. xwork2.util. profiling. UtilTimerStack. profile (UtilTimerStack. java: 455)
At com. opensymphony. xwork2.defaactionactioninvocation. invoke (defaactionactioninvocation. java: 221)
At com. opensymphony. xwork2.interceptor. ExceptionMappingInterceptor. intercept (ExceptionMappingInterceptor. java: 176)
At com. opensymphony. xwork2.DefaultActionInvocation $2. doProfiling (DefaultActionInvocation. java: 224)
At com. opensymphony. xwork2.DefaultActionInvocation $2. doProfiling (DefaultActionInvocation. java: 223)
At com. opensymphony. xwork2.util. profiling. UtilTimerStack. profile (UtilTimerStack. java: 455)
At com. opensymphony. xwork2.defaactionactioninvocation. invoke (defaactionactioninvocation. java: 221)
At org.apache.struts2.impl.StrutsActionProxy.exe cute (StrutsActionProxy. java: 50)
At org. apache. struts2.dispatcher. Dispatcher. serviceAction (Dispatcher. java: 504)
... 68 more

Solution:

You can also use transient to modify attributes with cyclic references. For example:

Private transient Dbarg dbarg;

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.