I got the following exception when marshalling Comment objects to JSON:
javax.xml.bind.JAXBException: class javax.jdo.identity.LongIdentity nor any of its super class is known to this context. at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextImpl.java:594) at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:648)
Below is my Comment definition, note that I mixed JAXB annotations (for marshalling) and JPA ones (for persistence with GAE).
@Entity
@XmlRootElement(name = "Comment")
@XmlAccessorType(XmlAccessType.FIELD)
public class Comment {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@XmlElement(name = "CommentId")
private Long commentId;
@Basic
@XmlElement(name = "Author")
private String author;
...
}
What I don't get is why the exception has something to do with LongIdentity?
Try annotating the properties instead of the fields. The JPA implementation may have used byte code manipulation to add a field of type LongIdentity.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With