Skip to main content

Unable to marshall - missing an @XmlRootElement annotation

2 replies [Last post]
Joined: 2006-02-21

When trying to marshall an object I get this error message:

unable to marshal type "org.blah.MessageType" as an element because it is missing an @XmlRootElement annotation

If I add the @XmlRootElement annotation to the MessageType, it works, but my question is why doesn't the JAXB compiler put this annotation in automatically. It's inconvenient because MessageType is automatically generated and I don't want to edit it every time I regenerate the java classes.

Is there any better way to resolve this problem?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2011-07-23
Joined: 2003-06-09