<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    On 4/10/13 2:31 AM, Thomas Lionel SMETS (prof) wrote:<br>
    <span style="white-space: pre;">&gt;<br>
      &gt; Hello,<br>
      &gt;<br>
      &gt; I base my code on what I found here :<br>
      &gt;
<a class="moz-txt-link-freetext" href="https://wiki.shibboleth.net/confluence/plugins/viewsource/viewpagesrc.action?pageId=3277019">https://wiki.shibboleth.net/confluence/plugins/viewsource/viewpagesrc.action?pageId=3277019</a></span><br>
    <br>
    <br>
    The code that you have posted looks fine, as far as I can tell.<br>
    <br>
    <br>
    <br>
    <span style="white-space: pre;">&gt;<br>
      &gt;<br>
      &gt; but the marshaller returned by the "marshallerFactory" is
      always "null" <br>
      &gt; thought listening to the logger "org.opensaml" shows no
      warning that the<br>
      &gt; initialization is not OK :(<br>
      &gt;</span><br>
    <br>
    <br>
    As Scott already said: assuming that the library has been correctly
    initialized with DefaultBootstrap, the issue is probably that you
    are trying to marshall an XMLObject/Element for which there is no
    registered marshaller.&nbsp; What is that XMLObject's QName (and also its
    xsi:type, if there is one?&nbsp; (Most won't have an xsi:type, unless
    you've explicitly added one.)<br>
    <br>
    <br>
    <br>
    <span style="white-space: pre;">&gt;<br>
      &gt;<br>
      &gt; [code]<br>
      &gt; public byte[] marshall(final XMLObject samlToken) throws<br>
      &gt; MarshallingException, ParserConfigurationException,
      TransformerException {<br>
      &gt;<br>
      &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (LOG.isTraceEnabled())<br>
      &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LOG.trace("Request to marshall : " +<br>
      &gt; LoggingConstant.START_TRACE_TAG + samlToken.toString() +<br>
      &gt; LoggingConstant.END_TRACE_TAG);</span><br>
    <br>
    What does this output actually say?&nbsp; There's also a better way to
    log the element's "name".&nbsp; There is a method on the XMLObject that
    exposes the element QName.<br>
    <br>
    <br>
    <br>
    <span style="white-space: pre;">&gt;<br>
      &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; javax.xml.parsers.DocumentBuilder docBuilder;<br>
      &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Get the marshaller factory<br>
      &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MarshallerFactory marshallerFactory =<br>
      &gt; Configuration.getMarshallerFactory();<br>
      &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Get the Subject marshaller<br>
      &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Marshaller marshaller =<br>
      &gt; marshallerFactory.getMarshaller(samlToken); // marshaller is
      'null'<br>
      &gt; after this statement</span><br>
    <br>
    <br>
    Yeah, you're not doing anything wrong here, this is the correct
    code.&nbsp;&nbsp; The problem is either in what you are trying to marshall, or
    in something about the configuration, initialization, environment,
    etc.&nbsp; On environmental issues: if you have an odd classloader
    hierarchy, this can cause problems.&nbsp; If you just have all the
    opensaml jars + deps in the same classloader as your app code, then
    that's fine.&nbsp; But if you're trying to distribute them in some way in
    a hierarchical classloader environment, that could possibly be
    another issue.<br>
    <br>
    --Brent<br>
    <br>
    <br>
  </body>
</html>