<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Hello,<br>
    <br>
    i'm moving now from geotoolkit to Apache SIS, progressively, by
    using Geotk 4.0-M1 which uses some apache SIS modules (0.3-jdk7),
    and in the meantime, moving from jdk6 to jdk7.<br>
    <br>
    What i have is a class that extends the DefaultMetadata.<br>
    I have a marshaller unit test that works fine. And the main
    application of my program works fine to marshall the metadata when i
    use it directly from Eclipse.<br>
    <br>
    To use the my tool outside Eclipse, i've built a shaded Jar with
    Maven to embedd all dependencies.<br>
    But when i try to to run it the main application from command line,
    i get an error dealing with JAXB context.<br>
    <br>
    I was previously using similar code with geotk, and it was working
    properly.<br>
    <br>
    The first error i get deals with the missing annotation
    @XmlRootElement(name = "MD_Metadata") for my subclass<br>
    <br>
    <font color="#3333ff"><small><i>Exception in thread "main"
          java.lang.Exception: Fail to publish data/metadata pair</i><i><br>
        </i><i>        at
          org.fao.fi.gems.publisher.Publisher.publish(Publisher.java:91)</i><i><br>
        </i><i>        at
org.fao.fi.gems.application.MetadataGenerator.main(MetadataGenerator.java:178)</i><i><br>
        </i><i>Caused by: java.lang.Exception: Failed to publish
          metadata</i><i><br>
        </i><i>        at
org.fao.fi.gems.publisher.MetadataPublisher.publishMetadata(MetadataPublisher.java:104)</i><i><br>
        </i><i>        at
          org.fao.fi.gems.publisher.Publisher.publish(Publisher.java:68)</i><i><br>
        </i><i>        ... 1 more</i><i><br>
        </i><i>Caused by: javax.xml.bind.MarshalException</i><i><br>
        </i><i> - with linked exception:</i><i><br>
        </i><i>[com.sun.istack.internal.SAXException2: unable to marshal
          type "org.fao.fi.gems.GemsMetadata" as an</i><i><br>
        </i><i>element because it is missing an @XmlRootElement
          annotation]</i><i><br>
        </i><i>        at
          com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.write(Unknown
          Source)</i><i><br>
        </i><i>        at
          com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.marshal(Unknown
          Source)</i><i><br>
        </i><i>        at
          javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(Unknown
          Source)</i><i><br>
        </i><i>        at
          org.apache.sis.xml.PooledMarshaller.marshal(PooledMarshaller.java:138)</i><i><br>
        </i><i>        at org.apache.sis.xml.XML.marshal(XML.java:374)</i><i><br>
        </i><i>        at
org.fao.fi.gems.publisher.MetadataPublisher.publishMetadata(MetadataPublisher.java:84)</i><i><br>
        </i><i>        ... 2 more</i><i><br>
        </i><i>Caused by: com.sun.istack.internal.SAXException2: unable
          to marshal type "org.fao.fi.gems.GemsMetada</i><i><br>
        </i><i>ta" as an element because it is missing an
          @XmlRootElement annotation</i><i><br>
        </i><i>        at
          com.sun.xml.internal.bind.v2.runtime.XMLSerializer.reportError(Unknown
          Source)</i><i><br>
        </i><i>        at
          com.sun.xml.internal.bind.v2.runtime.ClassBeanInfoImpl.serializeRoot(Unknown
          Source)</i><i><br>
        </i><i>        at
          com.sun.xml.internal.bind.v2.runtime.XMLSerializer.childAsRoot(Unknown
          Source)</i><i><br>
        </i><i>        ... 8 more</i></small></font><br>
    <br>
    After adding the missing annotation, everything still works (tests,
    main app in Eclipse)<br>
    If i try to run the app with the shaded jar, i get the following
    error:<br>
    <br>
    <font color="#3333ff"><small><i>Exception in thread "main"
          java.lang.Exception: Fail to publish data/metadata pair</i><i><br>
        </i><i>        at
          org.fao.fi.gems.publisher.Publisher.publish(Publisher.java:91)</i><i><br>
        </i><i>        at
org.fao.fi.gems.application.MetadataGenerator.main(MetadataGenerator.java:178)</i><i><br>
        </i><i>Caused by: java.lang.Exception: Failed to publish
          metadata</i><i><br>
        </i><i>        at
org.fao.fi.gems.publisher.MetadataPublisher.publishMetadata(MetadataPublisher.java:104)</i><i><br>
        </i><i>        at
          org.fao.fi.gems.publisher.Publisher.publish(Publisher.java:68)</i><i><br>
        </i><i>        ... 1 more</i><i><br>
        </i><i>Caused by: javax.xml.bind.MarshalException</i><i><br>
        </i><i> - with linked exception:</i><i><br>
        </i><i>[com.sun.istack.internal.SAXException2: unable to marshal
          type "org.fao.fi.gems.GemsMetadata" as an</i><i><br>
        </i><i>element because it is not known to this context.]</i><i><br>
        </i><i>        at
          com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.write(Unknown
          Source)</i><i><br>
        </i><i>        at
          com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.marshal(Unknown
          Source)</i><i><br>
        </i><i>        at
          javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(Unknown
          Source)</i><i><br>
        </i><i>        at
          org.apache.sis.xml.PooledMarshaller.marshal(PooledMarshaller.java:138)</i><i><br>
        </i><i>        at org.apache.sis.xml.XML.marshal(XML.java:374)</i><i><br>
        </i><i>        at
org.fao.fi.gems.publisher.MetadataPublisher.publishMetadata(MetadataPublisher.java:84)</i><i><br>
        </i><i>        ... 2 more</i><i><br>
        </i><i>Caused by: com.sun.istack.internal.SAXException2: unable
          to marshal type "org.fao.fi.gems.GemsMetada</i><i><br>
        </i><i>ta" as an element because it is not known to this
          context.</i><i><br>
        </i><i>        at
          com.sun.xml.internal.bind.v2.runtime.XMLSerializer.reportError(Unknown
          Source)</i><i><br>
        </i><i>        at
          com.sun.xml.internal.bind.v2.runtime.ClassBeanInfoImpl.serializeRoot(Unknown
          Source)</i><i><br>
        </i><i>        at
          com.sun.xml.internal.bind.v2.runtime.XMLSerializer.childAsRoot(Unknown
          Source)</i><i><br>
        </i><i>        ... 8 more</i><i><br>
        </i></small></font><br>
    Do you have any idea what is wrong? (and also why would i need to
    add <i>xmlRootElement</i>? )<br>
    What are the differences between the geotk JAXB xml marshaller and
    the Apache SIS one?<br>
    <br>
    I would be very grateful if you could advice how to solve this...<br>
    <br>
    Many thanks in advance<br>
    Kind regards<br>
    <br>
    <div class="moz-signature">-- <br>
      <span style="font: 80% Arial,sans-serif;"><b>Emmanuel Blondel</b><br>
      </span>
      <span style="font: 80% Arial,sans-serif;">GIS Consultant<br>
      </span>
      <span style="font: 80% Arial,sans-serif;">Engineer in Agronomy
        & Environment<br>
        <br>
      </span>
      <span style="font: 80% Arial,sans-serif;">Geographic Information
        Systems<br>
        in Agronomy - Environment - Fisheries<br>
        Email: <a class="moz-txt-link-abbreviated" href="mailto:emmanuel.blondel1@gmail.com">emmanuel.blondel1@gmail.com</a> - <a class="moz-txt-link-abbreviated" href="mailto:Emmanuel.Blondel@fao.org">Emmanuel.Blondel@fao.org</a><br>
      </span>
      <a href="http://fr.linkedin.com/in/emmanuelblondel1"
        style="text-decoration:none;"><span style="font: 80%
          Arial,sans-serif; color:#0783B6;"><img
            src="cid:part1.08060808.07040805@gmail.com" alt="View my
            LinkedIn profile" style="vertical-align:middle" width="20"
            height="15" border="0">View my LinkedIn profile</span></a></div>
  </body>
</html>