When you are trying marshal MyClass, that is not anotated as @XmlRootElement element, you can obtain:
unable to marshal type "org.company.MyClass" as an element because it is missing an @XmlRootElement annotation
Possible workaround is marshal your object in this way:
I have found, that more details can be found here:
http://weblogs.java.net/blog/2006/03/03/why-does-jaxb-put-xmlrootelement-sometimes-not-always
http://stackoverflow.com/questions/819720/no-xmlrootelement-generated-by-jaxb