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

Emmanuel Blondel emmanuel.blondel1 at gmail.com
Wed Jul 23 00:51:48 PDT 2014


Thanks Martin,

I've tried your suggestion, but it does not work. I get back the error 
saying that i miss the XmlRootElement..
With or without annotations, my junit test works well. I'm wondering if 
it's a problem with the shaded JAR? some missing dependency? Any idea?

Emmanuel

Le 23/07/2014 00:34, Martin Desruisseaux a écrit :
> 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