[geotk] Problem with XML marshalling

Emmanuel Blondel emmanuel.blondel1 at gmail.com
Fri Nov 2 01:52:54 PDT 2012


Hello all,

I'm new to the Geotoolkit list. I've started using it in order to 
generate metadata compliant with the ISO 19115/19139 stantard. Until 
now, i used the version 3.x-SNAPSHOT.
Here below some code of generic metadata I've problems with:


final DefaultMetadata metadata = new DefaultMetadata();

//File identifier
UUID uuid = UUID.randomUUID();
String fileIdentifier = uuid.toString();
metadata.setFileIdentifier(fileIdentifier);

//Language
metadata.setLanguage(Locale.ENGLISH);

//CharacterSet
metadata.setCharacterSet(CharacterSet.UTF_8);

//Hierarchy levels
metadata.getHierarchyLevels().add(ScopeCode.DATASET);

//DateStamp
metadata.setDateStamp(new Date());

//Metadata standard
metadata.setMetadataStandardName("ISO 19115:2003/19139"); //standard
metadata.setMetadataStandardVersion("1.0"); //version

System.out.println(metadata);
XML.marshal(metadata, System.out);


* The System.out.println of metadata object is returned well:

Metadata
????Date Stamp………………………………………… 2 novembre 2012 09:43:27 CET
????Character Set………………………………… utf 8
????Hierarchy Levels………………………… dataset
????Language……………………………………………… anglais
????File Identifier…………………………… e3d1684e-063d-4635-a513-5a440398d5e3
????Metadata Standard Name………… ISO 19115:2003/19139
????Metadata Standard Version… 1.0

* Nevertheless, the XML marshalling gives the following error:

Exception in thread "main" java.lang.NoSuchMethodError: 
org.opengis.util.CodeList.names()[Ljava/lang/String;
at org.geotoolkit.internal.CodeLists.sentence(CodeLists.java:152)
at 
org.geotoolkit.internal.jaxb.code.CodeListProxy.<init>(CodeListProxy.java:169)
at 
org.geotoolkit.internal.jaxb.code.CodeListAdapter.marshal(CodeListAdapter.java:136)
at 
org.geotoolkit.internal.jaxb.code.CodeListAdapter.marshal(CodeListAdapter.java:53)
at 
com.sun.xml.internal.bind.v2.runtime.reflect.AdaptedAccessor.get(AdaptedAccessor.java:61)
at 
com.sun.xml.internal.bind.v2.runtime.property.SingleElementNodeProperty.serializeBody(SingleElementNodeProperty.java:116)
at 
com.sun.xml.internal.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:306)
at 
com.sun.xml.internal.bind.v2.runtime.XMLSerializer.childAsSoleContent(XMLSerializer.java:561)
at 
com.sun.xml.internal.bind.v2.runtime.ClassBeanInfoImpl.serializeRoot(ClassBeanInfoImpl.java:290)
at 
com.sun.xml.internal.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:462)
at 
com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:314)
at 
com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:243)
at 
javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:75)
at org.geotoolkit.xml.PooledMarshaller.marshal(PooledMarshaller.java:121)
at org.geotoolkit.xml.XML.marshal(XML.java:292)
at org.gis.metadata.App.main(App.java:50)

* In the above piece of code, If i remove the line
metadata.setCharacterSet(CharacterSet.UTF_8);
then the marshalling returns well the XML output.

* This is only for some of the metadata, as example, but I also faced 
the same error with the DataIdentificationInfo, e.g. impossible to set a 
DefaultContact (with phone etc) to a DefaultResponsibleParty.

Does anyone have an idea how to solve this?

Thanks a lot in advance,
Emmanuel


More information about the Geotoolkit mailing list