<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Brent, <div class=""><br class=""></div><div class="">Thanks for the answer. </div><div class=""><br class=""><div><blockquote type="cite" class=""><div class=""><div bgcolor="#FFFFFF" text="#000000" class=""><blockquote cite="mid:11F3D334-D82D-42CF-A2CF-2740F57EF9DE@mascanc.net" type="cite" class=""><div class="">My soap message is handled by saaj. When I get the
        SOAP header, and I unmarshall it, the DOM is </div>
      <div class=""><br class="">
      </div>
      <div class="">com.sun.xml.messaging.saaj.soap.impl.ElementImpl </div>
      <div class=""><br class="">
      </div>
    </blockquote>
    <br class="">
    I'm not personally familiar with SAAJ.  But I'm assuming that the
    way that you received the SOAP XML and parsed it to a DOM is not via
    our ParserPool, etc, but rather using some mechanism specific to
    SAAJ .  I suspect therein lies the problem (indirectly).
    <div class=""><br class=""></div></div></div></blockquote><div><br class=""></div>Exactly. The message is parsed to a DOM by SAAJ, which it seems to load directly the com.sun.org.apache… implementation. </div><div><br class=""><blockquote type="cite" class=""><div class=""><div bgcolor="#FFFFFF" text="#000000" class=""><div class="">
    </div>
    <br class="">
    <blockquote cite="mid:11F3D334-D82D-42CF-A2CF-2740F57EF9DE@mascanc.net" type="cite" class="">
      <div class=""><br class="">
      </div>
      <div class=""><br class="">
      </div>
      <div class=""><br class="">
      </div>
      <div class="">
        <div class="">2016-08-09 17:46:38,515 INFO  [stdout] I got an
          exception. My implementation is: class
          org.apache.xerces.dom.NodeImplfrom:
<a class="moz-txt-link-freetext" href="jar:file:/opt/bin/jboss1/modules/system/layers/base/com/main/xercesImpl-debug.2.9.1.jar!/">jar:file:/opt/bin/jboss1/modules/system/layers/base/com/main/xercesImpl-debug.2.9.1.jar!/</a></div>
        <div class="">2016-08-09 17:46:38,515 INFO  [stdout] Their
          implementation is: class
          com.sun.xml.messaging.saaj.soap.impl.ElementImplfrom:
          vfs:/opt/conf/jboss1/deployments/mydep.ear/lib/saaj-impl.jar</div>
        <div class="">2016-08-09 17:46:38,515 ERROR [stderr]
          java.lang.ClassCastException:
          com.sun.xml.messaging.saaj.soap.impl.ElementImpl cannot be
          cast to org.apache.xerces.dom.NodeImpl</div>
        <div class="">2016-08-09 17:46:38,515 ERROR [stderr] <span class="Apple-tab-span" style="white-space:pre">    </span>at
org.apache.xerces.dom.CoreDocumentImpl.adoptNode(CoreDocumentImpl.java:1760)</div>
        <div class="">2016-08-09 17:46:38,515 ERROR [stderr] <span class="Apple-tab-span" style="white-space:pre">    </span>at
org.opensaml.xml.util.XMLHelper.adoptElement(XMLHelper.java:545)</div>
      </div>
      <br class="">
    </blockquote>
    <br class="">
    <br class="">
    It would seem that the root cause problem here is that the Apache
    Xerces DOM classes don't support adopting Nodes from a different DOM
    impl.  The message seems to imply that it's trying to
    unconditionally cast the passed-in to-be-adopted Node to a Xerces
    NodeImpl, and it's not.<br class=""></div></div></blockquote><div><br class=""></div>I am confused now. I always been told to always use xerces through the endorsing mechanism. Is it still the case with java8? This error of “DOM Element node adoption failed” throw</div><div>by xmltooling is a longstanding fact, and you actually have you the xmltooling the explicit check. <br class=""><blockquote type="cite" class=""><div class=""><div bgcolor="#FFFFFF" text="#000000" class="">
    <br class="">
    <blockquote cite="mid:11F3D334-D82D-42CF-A2CF-2740F57EF9DE@mascanc.net" type="cite" class="">
      <div class="">(</div>
      <div class=""><br class="">
      </div>
      <div class="">Now, I really don’t know how to proceed. Any hints
        on aligning the DOM implementations? Before, with java6 and </div>
      <div class="">jboss4, I was used to the endorsing mechanism, but
        in java8 + wildfly9 it does not seem to have any effect.</div>
    </blockquote>
    <br class="">
    I don't have any concrete ideas.  The OpenSAML core code doesn't
    know about or have special handling to deal with the specifics or
    peculiarities of any particular DOM impl.  We use the standard DOM
    API, period.  So this is an "environmental" problem.  I'm not
    familiar with Wildfly or  SAAJ, so I can't give you specific
    suggestions unfortunately.  <br class="">
    <br class="">
    <blockquote cite="mid:11F3D334-D82D-42CF-A2CF-2740F57EF9DE@mascanc.net" type="cite" class="">
      <div class=""><br class="">
      </div>
      <div class="">Setting the system property on the
        DocumentBuilderFactory makes wildfly unhappy
        (ClassNotFoundExceptions). </div>
      <br class="">
    </blockquote>
    <br class="">
    That sounds like a good avenue to pursue.  The CNFE's might be
    solvable with classpath adjusting.  Or, figure out if it's possible
    to have SAAJ use the standard built-in Oracle Java Xerces impl,
    rather than whatever it's currently using.<br class=""></div></div></blockquote><div><br class=""></div><div><br class=""></div>What I found is that, once parsed, the Assertion (or in general XMLObject) object has a getDOM() method. What is the aim of that? It seems to retain the original DOM implementation! </div><div>In fact, in <a href="http://grepcode.com/file/repo1.maven.org/maven2/org.opensaml/xmltooling/1.4.1/org/opensaml/xml/util/XMLHelper.java?av=f" class="">http://grepcode.com/file/repo1.maven.org/maven2/org.opensaml/xmltooling/1.4.1/org/opensaml/xml/util/XMLHelper.java?av=f</a> on line 542, the code: </div><div><br class=""></div><div><div class="line" id="line-543" style="margin-top: -2px; padding-left: 10px; font-family: 'Lucida Grande', Tahoma, Verdana, Arial, Helvetica, sans-serif;"><pre style="margin-top: 0px; margin-bottom: 0px; display: inline;" class="">    <span class="kw" style="color: rgb(127, 0, 85); font-weight: bold;">public</span> <span class="kw" style="color: rgb(127, 0, 85); font-weight: bold;">static</span> <span class="kw" style="color: rgb(127, 0, 85); font-weight: bold;">void</span> <a class="context-menu" href="http://grepcode.com/file/repo1.maven.org/maven2/org.opensaml/xmltooling/1.4.1/org/opensaml/xml/util/XMLHelper.java?av=f#" style="padding: 0px 0px 0px 4px; margin: 0px; color: rgb(104, 144, 216); text-decoration: none; font-size: 1.4em;"><img class="img_base img_jdt_elcl16_thin_show_toolbar" border="0" title="More ..." width="11" height="16" style="margin-left: 3px; margin-right: 3px; background-image: url(http://grepcode.com/static/app/images/common_sprite.png); background-position: 0% -429px; background-repeat: no-repeat no-repeat;" apple-inline="yes" id="FCB11439-3441-4BC1-AA92-991519848091" apple-width="yes" apple-height="yes" src="cid:F75923DC-E164-42E4-9082-BB888C0FBC7B"></a><a name="XMLHelper.adoptElement%28org.w3c.dom.Element%2Corg.w3c.dom.Document%29" style="padding: 0px; margin: 0px;" class="">adoptElement</a>(<a href="http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b27/org/w3c/dom/Element.java#Element" title="org.w3c.dom.Element" style="padding: 0px; margin: 0px; color: rgb(51, 102, 187);" class="">Element</a> <span class="mark-85#0">adoptee</span>, <a href="http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b27/org/w3c/dom/Document.java#Document" title="org.w3c.dom.Document" style="padding: 0px; margin: 0px; color: rgb(51, 102, 187);" class="">Document</a> <span class="mark-86#0">adopter</span>) {</pre></div><div class="line" id="line-544" style="margin-top: -2px; padding-left: 10px; font-family: 'Lucida Grande', Tahoma, Verdana, Arial, Helvetica, sans-serif;"><div class="lnml" id="lnml-544" style="display: inline;"><img width="16" height="16" apple-inline="yes" id="FE15BF2F-1A29-4175-9DAF-627917338E69" apple-width="yes" apple-height="yes" src="cid:F75923DC-E164-42E4-9082-BB888C0FBC7B" class=""></div><div name="ln" class="ln" style="display: inline; margin: 0px; padding: 0px 6px;"><pre style="margin-top: 0px; margin-bottom: 0px; display: inline;" class=""><a name="544" href="http://grepcode.com/file/repo1.maven.org/maven2/org.opensaml/xmltooling/1.4.1/org/opensaml/xml/util/XMLHelper.java?av=f#544" style="padding: 0px; margin: 0px; color: rgb(103, 103, 103); text-decoration: none;" class="">544</a></pre></div><div class="lnmr" id="lnmr-544" style="display: inline;"><a title="Generate HTML widget" href="http://grepcode.com/file/repo1.maven.org/maven2/org.opensaml/xmltooling/1.4.1/org/opensaml/xml/util/XMLHelper.java?av=f#" style="padding: 0px; margin: 0px; color: rgb(51, 102, 187); text-decoration: none; border: 0px;" class=""><img id="lnhs-544" width="16" height="16" style="border: 0px;" apple-inline="yes" apple-width="yes" apple-height="yes" src="cid:F75923DC-E164-42E4-9082-BB888C0FBC7B" class=""></a></div><pre style="margin-top: 0px; margin-bottom: 0px; display: inline;" class="">         <span class="kw" style="color: rgb(127, 0, 85); font-weight: bold;">if</span> (!(<span class="mark-85#1">adoptee</span>.<a href="http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b27/org/w3c/dom/Node.java#Node.getOwnerDocument%28%29" title="org.w3c.dom.Node.getOwnerDocument() : Document" style="padding: 0px; margin: 0px; color: rgb(51, 102, 187);" class="">getOwnerDocument</a>().<a href="http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b27/java/lang/Object.java#Object.equals%28java.lang.Object%29" title="java.lang.Object.equals(java.lang.Object) : boolean" style="padding: 0px; margin: 0px; color: rgb(51, 102, 187);" class="">equals</a>(<span class="mark-86#1">adopter</span>))) {</pre></div><div class="line" id="line-545" style="margin-top: -2px; padding-left: 10px; font-family: 'Lucida Grande', Tahoma, Verdana, Arial, Helvetica, sans-serif;"><div class="lnml" id="lnml-545" style="display: inline;"><img width="16" height="16" apple-inline="yes" id="69331F66-D18B-4F37-BF0A-0887E1F87191" apple-width="yes" apple-height="yes" src="cid:F75923DC-E164-42E4-9082-BB888C0FBC7B" class=""></div><div name="ln" class="ln" style="display: inline; margin: 0px; padding: 0px 6px;"><pre style="margin-top: 0px; margin-bottom: 0px; display: inline;" class=""><a name="545" href="http://grepcode.com/file/repo1.maven.org/maven2/org.opensaml/xmltooling/1.4.1/org/opensaml/xml/util/XMLHelper.java?av=f#545" style="padding: 0px; margin: 0px; color: rgb(103, 103, 103); text-decoration: none;" class="">545</a></pre></div><div class="lnmr" id="lnmr-545" style="display: inline;"><a title="Generate HTML widget" href="http://grepcode.com/file/repo1.maven.org/maven2/org.opensaml/xmltooling/1.4.1/org/opensaml/xml/util/XMLHelper.java?av=f#" style="padding: 0px; margin: 0px; color: rgb(51, 102, 187); text-decoration: none; border: 0px;" class=""><img id="lnhs-545" width="16" height="16" style="border: 0px;" apple-inline="yes" apple-width="yes" apple-height="yes" src="cid:F75923DC-E164-42E4-9082-BB888C0FBC7B" class=""></a></div><pre style="margin-top: 0px; margin-bottom: 0px; display: inline;" class="">             <span class="kw" style="color: rgb(127, 0, 85); font-weight: bold;">if</span> (<span class="mark-86#1">adopter</span>.<a href="http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b27/org/w3c/dom/Document.java#Document.adoptNode%28org.w3c.dom.Node%29" title="org.w3c.dom.Document.adoptNode(org.w3c.dom.Node) : Node" style="padding: 0px; margin: 0px; color: rgb(51, 102, 187);" class="">adoptNode</a>(<span class="mark-85#1">adoptee</span>) == <span class="kw" style="color: rgb(127, 0, 85); font-weight: bold;">null</span>) {</pre></div><div class="line" id="line-546" style="margin-top: -2px; padding-left: 10px; font-family: 'Lucida Grande', Tahoma, Verdana, Arial, Helvetica, sans-serif;"><div class="lnml" id="lnml-546" style="display: inline;"><img width="16" height="16" apple-inline="yes" id="BC7463CC-C91E-42FC-A0FC-07FAB93D4217" apple-width="yes" apple-height="yes" src="cid:F75923DC-E164-42E4-9082-BB888C0FBC7B" class=""></div><div name="ln" class="ln" style="display: inline; margin: 0px; padding: 0px 6px;"><pre style="margin-top: 0px; margin-bottom: 0px; display: inline;" class=""><a name="546" href="http://grepcode.com/file/repo1.maven.org/maven2/org.opensaml/xmltooling/1.4.1/org/opensaml/xml/util/XMLHelper.java?av=f#546" style="padding: 0px; margin: 0px; color: rgb(103, 103, 103); text-decoration: none;" class="">546</a></pre></div><div class="lnmr" id="lnmr-546" style="display: inline;"><a title="Generate HTML widget" href="http://grepcode.com/file/repo1.maven.org/maven2/org.opensaml/xmltooling/1.4.1/org/opensaml/xml/util/XMLHelper.java?av=f#" style="padding: 0px; margin: 0px; color: rgb(51, 102, 187); text-decoration: none; border: 0px;" class=""><img id="lnhs-546" width="16" height="16" style="border: 0px;" apple-inline="yes" apple-width="yes" apple-height="yes" src="cid:F75923DC-E164-42E4-9082-BB888C0FBC7B" class=""></a></div><pre style="margin-top: 0px; margin-bottom: 0px; display: inline;" class="">                 <span class="comment" style="color: rgb(103, 103, 103);">// This can happen if the adopter and adoptee were produced by different DOM implementations</span></pre></div><div class="line" id="line-547" style="margin-top: -2px; padding-left: 10px; font-family: 'Lucida Grande', Tahoma, Verdana, Arial, Helvetica, sans-serif;"><div class="lnml" id="lnml-547" style="display: inline;"><img width="16" height="16" apple-inline="yes" id="A8E94039-A5A2-41EB-90C8-78398E98E3E8" apple-width="yes" apple-height="yes" src="cid:F75923DC-E164-42E4-9082-BB888C0FBC7B" class=""></div><div name="ln" class="ln" style="display: inline; margin: 0px; padding: 0px 6px;"><pre style="margin-top: 0px; margin-bottom: 0px; display: inline;" class=""><a name="547" href="http://grepcode.com/file/repo1.maven.org/maven2/org.opensaml/xmltooling/1.4.1/org/opensaml/xml/util/XMLHelper.java?av=f#547" style="padding: 0px; margin: 0px; color: rgb(103, 103, 103); text-decoration: none;" class="">547</a></pre></div><div class="lnmr" id="lnmr-547" style="display: inline;"><a title="Generate HTML widget" href="http://grepcode.com/file/repo1.maven.org/maven2/org.opensaml/xmltooling/1.4.1/org/opensaml/xml/util/XMLHelper.java?av=f#" style="padding: 0px; margin: 0px; color: rgb(51, 102, 187); text-decoration: none; border: 0px;" class=""><img id="lnhs-547" width="16" height="16" style="border: 0px;" apple-inline="yes" apple-width="yes" apple-height="yes" src="cid:F75923DC-E164-42E4-9082-BB888C0FBC7B" class=""></a></div><pre style="margin-top: 0px; margin-bottom: 0px; display: inline;" class="">                 <span class="kw" style="color: rgb(127, 0, 85); font-weight: bold;">throw</span> <span class="kw" style="color: rgb(127, 0, 85); font-weight: bold;">new</span> <a href="http://grepcode.com/file/repo1.maven.org/maven2/org.opensaml/xmltooling/1.4.1/org/opensaml/xml/XMLRuntimeException.java#XMLRuntimeException" title="org.opensaml.xml.XMLRuntimeException" style="padding: 0px; margin: 0px; color: rgb(51, 102, 187);" class="">XMLRuntimeException</a>(<span class="strliteral" style="color: rgb(42, 0, 255);">"DOM Element node adoption failed"</span>);</pre></div><div class="line" id="line-548" style="margin-top: -2px; padding-left: 10px; font-family: 'Lucida Grande', Tahoma, Verdana, Arial, Helvetica, sans-serif;"><div class="lnml" id="lnml-548" style="display: inline;"><img width="16" height="16" apple-inline="yes" id="01D88628-F7DE-4927-8554-12F81E7E695B" apple-width="yes" apple-height="yes" src="cid:F75923DC-E164-42E4-9082-BB888C0FBC7B" class=""></div><div name="ln" class="ln" style="display: inline; margin: 0px; padding: 0px 6px;"><pre style="margin-top: 0px; margin-bottom: 0px; display: inline;" class=""><a name="548" href="http://grepcode.com/file/repo1.maven.org/maven2/org.opensaml/xmltooling/1.4.1/org/opensaml/xml/util/XMLHelper.java?av=f#548" style="padding: 0px; margin: 0px; color: rgb(103, 103, 103); text-decoration: none;" class="">548</a></pre></div><div class="lnmr" id="lnmr-548" style="display: inline;"><a title="Generate HTML widget" href="http://grepcode.com/file/repo1.maven.org/maven2/org.opensaml/xmltooling/1.4.1/org/opensaml/xml/util/XMLHelper.java?av=f#" style="padding: 0px; margin: 0px; color: rgb(51, 102, 187); text-decoration: none; border: 0px;" class=""><img id="lnhs-548" width="16" height="16" style="border: 0px;" apple-inline="yes" apple-width="yes" apple-height="yes" src="cid:F75923DC-E164-42E4-9082-BB888C0FBC7B" class=""></a></div><pre style="margin-top: 0px; margin-bottom: 0px; display: inline;" class="">             }</pre></div><div class="line" id="line-549" style="margin-top: -2px; padding-left: 10px; font-family: 'Lucida Grande', Tahoma, Verdana, Arial, Helvetica, sans-serif;"><div class="lnml" id="lnml-549" style="display: inline;"><img width="16" height="16" apple-inline="yes" id="F5F45E41-6DC1-4175-8A52-22C99F7D23F5" apple-width="yes" apple-height="yes" src="cid:F75923DC-E164-42E4-9082-BB888C0FBC7B" class=""></div><div name="ln" class="ln" style="display: inline; margin: 0px; padding: 0px 6px;"><pre style="margin-top: 0px; margin-bottom: 0px; display: inline;" class=""><a name="549" href="http://grepcode.com/file/repo1.maven.org/maven2/org.opensaml/xmltooling/1.4.1/org/opensaml/xml/util/XMLHelper.java?av=f#549" style="padding: 0px; margin: 0px; color: rgb(103, 103, 103); text-decoration: none;" class="">549</a></pre></div><div class="lnmr" id="lnmr-549" style="display: inline;"><a title="Generate HTML widget" href="http://grepcode.com/file/repo1.maven.org/maven2/org.opensaml/xmltooling/1.4.1/org/opensaml/xml/util/XMLHelper.java?av=f#" style="padding: 0px; margin: 0px; color: rgb(51, 102, 187); text-decoration: none; border: 0px;" class=""><img id="lnhs-549" width="16" height="16" style="border: 0px;" apple-inline="yes" apple-width="yes" apple-height="yes" src="cid:F75923DC-E164-42E4-9082-BB888C0FBC7B" class=""></a></div><pre style="margin-top: 0px; margin-bottom: 0px; display: inline;" class="">         }</pre></div><div class="line" id="line-550" style="margin-top: -2px; padding-left: 10px; font-family: 'Lucida Grande', Tahoma, Verdana, Arial, Helvetica, sans-serif;"><div class="lnml" id="lnml-550" style="display: inline;"><img width="16" height="16" apple-inline="yes" id="9BF445CC-564E-47EF-A5B4-4324E6271050" apple-width="yes" apple-height="yes" src="cid:F75923DC-E164-42E4-9082-BB888C0FBC7B" class=""></div><div name="ln" class="ln" style="display: inline; margin: 0px; padding: 0px 6px;"><pre style="margin-top: 0px; margin-bottom: 0px; display: inline;" class=""><a name="550" href="http://grepcode.com/file/repo1.maven.org/maven2/org.opensaml/xmltooling/1.4.1/org/opensaml/xml/util/XMLHelper.java?av=f#550" style="padding: 0px; margin: 0px; color: rgb(103, 103, 103); text-decoration: none;" class="">550</a></pre></div><div class="lnmr" id="lnmr-550" style="display: inline;"><a title="Generate HTML widget" href="http://grepcode.com/file/repo1.maven.org/maven2/org.opensaml/xmltooling/1.4.1/org/opensaml/xml/util/XMLHelper.java?av=f#" style="padding: 0px; margin: 0px; color: rgb(51, 102, 187); text-decoration: none; border: 0px;" class=""><img id="lnhs-550" width="16" height="16" style="border: 0px;" apple-inline="yes" apple-width="yes" apple-height="yes" src="cid:F75923DC-E164-42E4-9082-BB888C0FBC7B" class=""></a></div><pre style="margin-top: 0px; margin-bottom: 0px; display: inline;" class="">     }</pre></div><div class=""><br class=""></div></div><div>We have “adopter" which seems to be the Assertion.getDOM() while the adoptee is the new element created by xerces. What is exactly returning the getDOM()? HOw is it generated?</div><br class=""><div class="">
--<br class="">Anger is a gift, <a href="http://www.mascanc.net/" class="">http://www.mascanc.net/</a>

</div>
<br class=""></div></body></html>