[geotk] Moving from geotk to Apache-sis - problems with metadata xml marshalling

Martin Desruisseaux desruisseaux at apache.org
Tue Jul 22 15:34:53 PDT 2014


Hello Emmanuel

Le 22/07/14 15:54, Adam Estrada a écrit :
>> What i have is a class that extends the DefaultMetadata. (...snip...)
>> The first error i get deals with the missing annotation @XmlRootElement(name = "MD_Metadata") for my subclass
>>
>> (...snip...)
>> Caused by: javax.xml.bind.MarshalException
>> com.sun.istack.internal.SAXException2: unable to marshal type "org.fao.fi.gems.GemsMetadata" as an element because it is missing an @XmlRootElement annotation
>> (...snip...)
>>
>> After adding the missing annotation, everything still works (tests, main app in Eclipse)
>> If i try to run the app with the shaded jar, i get the following error:
>>
>> (...snip...)
>> Caused by: javax.xml.bind.MarshalException
>> com.sun.istack.internal.SAXException2: unable to marshal type "org.fao.fi.gems.GemsMetadata" as an
>> element because it is not known to this context.

I would suggest to not put @XmlRootElement annotation in GemsMetadata,
and instead put a @XmlTransient annotation. I'm not sure however why it
worked before - I would have expected both the old Geotk and the new
Apache SIS objects to behave the same way in this regards. Maybe the
change in behaviour is related to the change in JDK version used, since
they come with different JAXB versions.

Regards,

    Martin



More information about the Geotoolkit mailing list