[英]saving twitter4J Status to MongoDB gives “twitter4j.Status is an interface, and JAXB can't handle interfaces”
尝试将List<Status>
保存到MongoDB(通过Morphia),但出现此编译时错误:
com.sun.xml.ws.spi.db.DatabindingException: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
twitter4j.Status is an interface, and JAXB can't handle interfaces.
this problem is related to the following location:
at twitter4j.Status
at public java.util.List Model.TwitterJob.getStatuses()
任何想法? 非常感谢!
StatusJSONImpl
Status
有点复杂,因为在Twitter4j 3.0中实现Status
的类StatusJSONImpl
受到保护。 您需要覆盖该类并使它对您的类可见。
请查看以下示例以了解详细信息。
您可以使用@XmlElement
批注指定Status
接口的实现类。
@XmlElement(type=SomeStatusImpl.class)
public List<Status> getStatuses() {
return statuses;
}
欲获得更多信息
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.