[geotk] Issues with ISO 19115 XML marshaller

Martin Desruisseaux martin.desruisseaux at geomatys.fr
Fri Jul 23 16:13:50 EDT 2010


Hello Damiano

About this exception:
> Exception in thread"main"  javax.xml.bind.JAXBException: class $Proxy0 nor any of its super class is known to this context.

The root class provided to JAXB must be one of the org.geotoolkit.metadata.iso 
package (or any other packages providing JAXB annotations). Only the root class; 
all other ones can be any implementations of GeoAPI interfaces.

Just insert the following line after the "Metadata data = Proxy..." line, which 
will perform a shallow copy (not a deep copy, so it is not too costly):

Metadata data = DefaultMetadata(data);

And it should work.



> Then, I have another "issue" with the marshaller, or at least, a question : how
> can I return some DataIdentification items from Metadata::getIdentificationInfo() ?
> (...snip...)

This is a bug in Geotk: we forgot to make JAXB adapters check for subtypes of a 
base type. It should be trivial to fix (maybe not toonigh because it is late. I 
will let you known when it will be done). In the time being, you can workaround 
by replacing the following line:

   identificationInfo.add(identification);

by

   identificationInfo.add(new DefaultDataIdentification(identification));

I realize that it is probably not what you want; I will let you known when the 
bug will be fixed.

An alternative workaround would be to extend DefaultDataIdentification rather 
than implement DataIdentification directly.

	Regards,

		Martin


More information about the Geotoolkit mailing list