I have a very complex object which I so far I used to serialize it to xml via @XmlRootElement
and worked perfectly well. Now I am writing REST and I need to serialize it to json. What happens is it throws StackOverflowError
exception. What I wrote so far is that the reason could be bi-directional mapping, but this is not the case with me I think. What could be the reason and how can I track if I miss bi-directional mapping, the object is really complex and supported from many people for very long time, is there a simple way I can track this that I can't think of?
Thanks!
EDIT Here is stack trace:
StackOverflowError
java.util.regex.Pattern.sequence(Pattern.java:1902)
java.util.regex.Pattern.expr(Pattern.java:1769)
java.util.regex.Pattern.compile(Pattern.java:1477)
java.util.regex.Pattern.<init>(Pattern.java:1150)
java.util.regex.Pattern.compile(Pattern.java:840)
net.sf.json.regexp.JdkRegexpMatcher.<init>(JdkRegexpMatcher.java:38)
net.sf.json.regexp.JdkRegexpMatcher.<init>(JdkRegexpMatcher.java:31)
net.sf.json.regexp.RegexpUtils.getMatcher(RegexpUtils.java:39)
net.sf.json.util.JSONTokener.matches(JSONTokener.java:113)
net.sf.json.JSONObject._fromJSONTokener(JSONObject.java:962)
net.sf.json.JSONObject.fromObject(JSONObject.java:156)
net.sf.json.util.JSONTokener.nextValue(JSONTokener.java:350)
net.sf.json.JSONObject._fromJSONTokener(JSONObject.java:1006)
net.sf.json.JSONObject.fromObject(JSONObject.java:156)
net.sf.json.util.JSONTokener.nextValue(JSONTokener.java:350)
net.sf.json.JSONObject._fromJSONTokener(JSONObject.java:1006)
net.sf.json.JSONObject.fromObject(JSONObject.java:156)
net.sf.json.util.JSONTokener.nextValue(JSONTokener.java:350)
net.sf.json.JSONObject._fromJSONTokener(JSONObject.java:1006)
net.sf.json.JSONObject.fromObject(JSONObject.java:156)
net.sf.json.util.JSONTokener.nextValue(JSONTokener.java:350)
net.sf.json.JSONObject._fromJSONTokener(JSONObject.java:1006)
net.sf.json.JSONObject.fromObject(JSONObject.java:156)
net.sf.json.util.JSONTokener.nextValue(JSONTokener.java:350)
net.sf.json.JSONObject._fromJSONTokener(JSONObject.java:1006)
net.sf.json.JSONObject.fromObject(JSONObject.java:156)
net.sf.json.util.JSONTokener.nextValue(JSONTokener.java:350)
net.sf.json.JSONObject._fromJSONTokener(JSONObject.java:1006)
net.sf.json.JSONObject.fromObject(JSONObject.java:156)
net.sf.json.util.JSONTokener.nextValue(JSONTokener.java:350)
net.sf.json.JSONObject._fromJSONTokener(JSONObject.java:1006)
net.sf.json.JSONObject.fromObject(JSONObject.java:156)
net.sf.json.util.JSONTokener.nextValue(JSONTokener.java:350)
net.sf.json.JSONObject._fromJSONTokener(JSONObject.java:1006)
net.sf.json.JSONObject.fromObject(JSONObject.java:156)
net.sf.json.util.JSONTokener.nextValue(JSONTokener.java:350)
net.sf.json.JSONObject._fromJSONTokener(JSONObject.java:1006)
net.sf.json.JSONObject.fromObject(JSONObject.java:156)
net.sf.json.util.JSONTokener.nextValue(JSONTokener.java:350)
net.sf.json.JSONObject._fromJSONTokener(JSONObject.java:1006