Usually with JAXB we are mapping POJOs to XML. In this example I will demonstrate how to handle a Java model that is exposed through a set of interfaces. This post was inspired by an answer I gave (feel free to upvote) to a question on Stack Overflow. In the question the poster was running into exceptions like the one below. This post will cover how to properly map this use case.
Exception in thread "main" com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 6 counts of IllegalAnnotationExceptions blog.interfaces.Customer is an interface, and JAXB can't handle interfaces. this problem is related to the following location: at blog.interfaces.Customer blog.interfaces.Customer does not have a no-arg default constructor. this problem is related to the following location: at blog.interfaces.Customer ...