javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"Group")
It looks like your XML document has the root element "Group" instead of "group". You can:
- Change the root element on your XML to be "group"
- Add the annotation @XmlRootElement(name="Group") to the Group classs.
You need to put package-info.java in your generated jaxb package. Its content should be something like that
@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.example.org/StudentOperations/")
package generated.marsh;
Luckily, the package-info class isn't required. I was able to fix mine problem with iowatiger08 solution.
Here is my fix showing the error message to help join the dots for some.
javax.xml.bind.UnmarshalException: unexpected element (uri:"http://global.aon.bz/schema/cbs/archive/errorresource/0", local:"errorresource"). Expected elements are <{}errorresource>
Code before fix
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name="", propOrder={"error"})
@XmlRootElement(name="errorresource")
public class Errorresource
Code after fix
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name="", propOrder={"error"})
@XmlRootElement(name="errorresource", namespace="http://global.aon.bz/schema/cbs/archive/errorresource/0")
public class Errorresource
You can see the namespace added to @XmlRootElement as indicated in the error message.