Currently there isn't enough information in you class for JAXB to know which class to instantiate based on the root element. You can do one of the following:
- Add
@XmlRootElement
on yourCustomer
class to explicitly map theCustomer
class to thecustomer
root element. Use an
unmarshal
method that takes aClass
parameter:JAXBElement<Customer> je = unmarshaller.unmarshal(source, Customer.class); Customer customer = je.getValue();
For More Information