我以前使用过JAXB从循环数据结构生成json,我想这次我做了同样的事情,但显然没有,因为我遇到了这个错误:
Jul 30, 2018 4:28:08 PM org.eclipse.yasson.internal.Marshaller marshall
SEVERE: Generating incomplete JSON
Jul 30, 2018 4:28:08 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [jersey-servlet] in context with path [/Kanzan] threw exception [org.glassfish.jersey.server.ContainerException: java.lang.StackOverflowError] with root cause
java.lang.StackOverflowError
at java.util.concurrent.ConcurrentHashMap$BaseIterator.<init>(ConcurrentHashMap.java:3389)
at java.util.concurrent.ConcurrentHashMap$ValueIterator.<init>(ConcurrentHashMap.java:3430)
at java.util.concurrent.ConcurrentHashMap$ValuesView.iterator(ConcurrentHashMap.java:4683)
at org.eclipse.yasson.internal.ComponentMatcher.searchComponentBinding(ComponentMatcher.java:179)
at org.eclipse.yasson.internal.ComponentMatcher.getSerializerBinding(ComponentMatcher.java:135)
at org.eclipse.yasson.internal.serializer.SerializerBuilder.build(SerializerBuilder.java:72)
at org.eclipse.yasson.internal.serializer.ObjectSerializer.marshallProperty(ObjectSerializer.java:91)
at org.eclipse.yasson.internal.serializer.ObjectSerializer.serializeInternal(ObjectSerializer.java:59)
at org.eclipse.yasson.internal.serializer.AbstractContainerSerializer.serialize(AbstractContainerSerializer.java:60)
at org.eclipse.yasson.internal.serializer.AbstractContainerSerializer.serializerCaptor(AbstractContainerSerializer.java:91)
at org.eclipse.yasson.internal.serializer.ObjectSerializer.marshallProperty(ObjectSerializer.java:92)
at org.eclipse.yasson.internal.serializer.ObjectSerializer.serializeInternal(ObjectSerializer.java:59)
at org.eclipse.yasson.internal.serializer.AbstractContainerSerializer.serialize(AbstractContainerSerializer.java:60)
at org.eclipse.yasson.internal.serializer.AbstractContainerSerializer.serializerCaptor(AbstractContainerSerializer.java:91)
at org.eclipse.yasson.internal.serializer.ObjectSerializer.marshallProperty(ObjectSerializer.java:92)
at org.eclipse.yasson.internal.serializer.ObjectSerializer.serializeInternal(ObjectSerializer.java:59)
这是来源:
@XmlAccessorType(XmlAccessType.FIELD)
@Entity
@Table(name="INTERVIEW")
public class Interview {
@Id
@GeneratedValue
@Column (name = "ID")
private int id;
@Column (name="DATE")
private Date date_;
@Column (name="TITLE")
private String title;
@Column (name="CEO")
private String ceo;
@OneToMany (mappedBy="interview", cascade = CascadeType.ALL, orphanRemoval = true)
private List<QA> QAs;
@OneToOne
@JoinColumn(name="STOCK_ID")
@XmlTransient
private Stock stock;
....GETTERS and SETTERS...
}
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
@Entity
@Table(name="STOCK")
public class Stock {
@Id
@GeneratedValue
@Column (name = "ID")
private int id;
@Column (name="TITLE")
@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, mappedBy = "stock")
private Interview interview;
....GETTERS AND SETTERS....
}
如果我从各自的网站上删除采访和股票参考,我可以进行封送。
答案 0 :(得分:0)
已解决。一些工作需要的运动衫
答案 1 :(得分:0)
不确定为什么OP不会共享jar,但至少会显示此错误消息
raw_data
对于我来说,具有以下依赖性已得到解决。
(timestamp)