JAXB: Can't unmarshal JAXBElement<?>, getting ElementNSImpl instead
问题 Related to JAXB: How to implement a JAXB-compatible variant wrapper class?, I tried to use JAXBElement to represent "variant" or "any-type". Marshalling went fine, but during Unmarshalling, JAXB tries to assign ElementNSImpl to a JAXBElement field. Test Code (copy+paste+run) import static java.lang.System.*; import java.io.*; import java.util.*; import javax.xml.bind.*; import javax.xml.bind.annotation.*; import javax.xml.namespace.*; import org.junit.*; public class _JaxbElementProblem {