杰克逊ObjectMapper抛出c​​om.fasterxml.jackson.databind.JsonMappingException:使用dom4j元素时发生无限递归(StackOverflowError)

时间:2019-04-05 13:57:31

标签: objectmapper jackson-databind dom4j

以下代码用于编写dom4j元素,

df1 <- structure(list(ID = c(1047699L, 858339L, 1002910L, 277135L, 753308L, 
1018840L, 1510295L, 3133L, 1467858L, 865436L), date_f = structure(c(16132, 
13573, 14600, 15023, 12486, 13935, 15268, 16128, 14666, 12727
), class = "Date")), row.names = c(NA, -10L), .internal.selfref = <pointer: 0x0000000002511ef0>, class = "data.frame")

它引发以下异常

df2 <- structure(list(ID = c(3133L, 3133L, 3133L, 3133L, 3133L, 3133L, 
3133L, 753308L, 753308L, 753308L, 753308L, 753308L, 753308L, 
753308L, 753308L, 753308L, 753308L, 753308L, 753308L, 753308L, 
753308L, 753308L, 753308L, 753308L, 753308L, 753308L, 753308L, 
1467858L, 1467858L, 1467858L, 1467858L, 1467858L, 1467858L, 1467858L, 
1467858L, 1467858L, 1467858L, 1467858L, 1467858L, 1467858L, 1467858L, 
1467858L, 1467858L, 1467858L, 1467858L, 1467858L, 1467858L, 277135L, 
277135L, 277135L, 277135L, 277135L, 277135L, 277135L, 277135L, 
277135L, 277135L, 277135L, 277135L, 277135L, 277135L, 277135L, 
277135L, 277135L, 277135L, 277135L, 277135L, 1002910L, 1002910L, 
1002910L, 1002910L, 1002910L, 1002910L, 1002910L, 1002910L, 1002910L, 
1002910L, 1002910L, 1002910L, 1002910L, 1002910L, 1002910L, 1002910L, 
1002910L, 1002910L, 1002910L, 1002910L, 858339L, 858339L, 858339L, 
858339L, 858339L, 858339L, 858339L, 858339L, 858339L, 858339L, 
858339L, 858339L, 858339L, 858339L, 858339L, 858339L, 858339L, 
858339L, 858339L, 858339L, 865436L, 865436L, 865436L, 865436L, 
865436L, 865436L, 865436L, 865436L, 865436L, 865436L, 865436L, 
865436L, 865436L, 865436L, 865436L, 865436L, 865436L, 865436L, 
1018840L, 1018840L, 1018840L, 1018840L, 1018840L, 1018840L, 1018840L, 
1018840L, 1018840L, 1018840L, 1018840L, 1018840L, 1018840L, 1018840L, 
1018840L, 1018840L, 1018840L, 1018840L, 1018840L, 1018840L, 1018840L, 
1047699L, 1047699L, 1047699L, 1047699L, 1047699L, 1047699L, 1047699L, 
1047699L, 1047699L, 1047699L, 1047699L, 1510295L, 1510295L, 1510295L, 
1510295L, 1510295L, 1510295L, 1510295L, 1510295L, 1510295L, 1510295L
), date = structure(c(10956, 11322, 11687, 12052, 12417, 12783, 
13148, 10956, 11322, 11687, 12052, 12417, 12783, 13148, 13513, 
13878, 14244, 14609, 14974, 15339, 15705, 16070, 16435, 16800, 
17166, 17531, 17896, 10956, 11322, 11687, 12052, 12417, 12783, 
13148, 13513, 13878, 14244, 14609, 14974, 15339, 15705, 16070, 
16435, 16800, 17166, 17531, 17896, 10956, 11322, 11687, 12052, 
12417, 12783, 13148, 13513, 13878, 14244, 14609, 14974, 15339, 
15705, 16070, 16435, 16800, 17166, 17531, 17896, 10956, 11322, 
11687, 12052, 12417, 12783, 13148, 13513, 13878, 17166, 14244, 
14609, 14974, 15339, 15705, 16070, 16435, 16800, 17531, 17896, 
10956, 11322, 11687, 12052, 12417, 12783, 13148, 13513, 13878, 
14244, 14609, 14974, 15339, 15705, 16070, 16435, 16800, 17166, 
17531, 17896, 10864, 11230, 11595, 11960, 12325, 12691, 13056, 
13421, 13786, 14152, 14517, 14882, 15247, 15613, 15978, 16343, 
16708, 17074, 10622, 10987, 11353, 11718, 12083, 12448, 12814, 
13179, 13544, 13909, 14275, 14640, 15005, 15370, 15736, 16101, 
16466, 16831, 17197, 17562, 17927, 10956, 11322, 11687, 12052, 
12417, 12783, 13148, 13513, 13878, 14244, 14609, 14609, 14974, 
15339, 15705, 16070, 16435, 16800, 17166, 17531, 17896), class = "Date"), 
    year = c(1999L, 2000L, 2001L, 2002L, 2003L, 2004L, 2005L, 
    1999L, 2000L, 2001L, 2002L, 2003L, 2004L, 2005L, 2006L, 2007L, 
    2008L, 2009L, 2010L, 2011L, 2012L, 2013L, 2014L, 2015L, 2016L, 
    2017L, 2018L, 1999L, 2000L, 2001L, 2002L, 2003L, 2004L, 2005L, 
    2006L, 2007L, 2008L, 2009L, 2010L, 2011L, 2012L, 2013L, 2014L, 
    2015L, 2016L, 2017L, 2018L, 1999L, 2000L, 2001L, 2002L, 2003L, 
    2004L, 2005L, 2006L, 2007L, 2008L, 2009L, 2010L, 2011L, 2012L, 
    2013L, 2014L, 2015L, 2016L, 2017L, 2018L, 1999L, 2000L, 2001L, 
    2002L, 2003L, 2004L, 2005L, 2006L, 2007L, 2016L, 2008L, 2009L, 
    2010L, 2011L, 2012L, 2013L, 2014L, 2015L, 2017L, 2018L, 1999L, 
    2000L, 2001L, 2002L, 2003L, 2004L, 2005L, 2006L, 2007L, 2008L, 
    2009L, 2010L, 2011L, 2012L, 2013L, 2014L, 2015L, 2016L, 2017L, 
    2018L, 1999L, 2000L, 2001L, 2002L, 2003L, 2004L, 2005L, 2006L, 
    2007L, 2008L, 2009L, 2010L, 2011L, 2012L, 2013L, 2014L, 2015L, 
    2016L, 1998L, 1999L, 2000L, 2001L, 2002L, 2003L, 2004L, 2005L, 
    2006L, 2007L, 2008L, 2009L, 2010L, 2011L, 2012L, 2013L, 2014L, 
    2015L, 2016L, 2017L, 2018L, 1999L, 2000L, 2001L, 2002L, 2003L, 
    2004L, 2005L, 2006L, 2007L, 2008L, 2009L, 2009L, 2010L, 2011L, 
    2012L, 2013L, 2014L, 2015L, 2016L, 2017L, 2018L)), row.names = c(NA, 
-167L), .internal.selfref = <pointer: 0x0000000002511ef0>, class = "data.frame")

是否无法使用jackson ObjectMapper编写dom4j元素?

我也尝试过XMLMapper()。同样的问题。 看起来DocumentFactory和dom4j Element的QName具有双向关系。我无法设置注释,因为它位于依赖项之内。

有人遇到这个问题吗?有办法解决这个问题吗?

0 个答案:

没有答案