<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p><br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 8/9/16 11:51 AM, Massimiliano Masi
      wrote:<br>
    </div>
    <blockquote
      cite="mid:11F3D334-D82D-42CF-A2CF-2740F57EF9DE@mascanc.net"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      Hi All, 
      <div class=""><br class="">
      </div>
      <div class="">I am running java 1.8 and wildfly 9. I have some
        issues with the DOM implementation, opensaml 2.6.1. </div>
      <div class=""><br class="">
      </div>
    </blockquote>
    <br>
    You know that OpenSAML 2.x is completely unsupported and EOL as of
    July 31, right?  But the problems/solutions here will be the same as
    for OpenSAML 3, so ...<br>
    <br>
    <br>
    <blockquote
      cite="mid:11F3D334-D82D-42CF-A2CF-2740F57EF9DE@mascanc.net"
      type="cite">
      <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>
    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>
    <br>
    <blockquote
      cite="mid:11F3D334-D82D-42CF-A2CF-2740F57EF9DE@mascanc.net"
      type="cite">
      <div class=""><br class="">
      </div>
      <div class=""><br>
      </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>
    </blockquote>
    <br>
    <br>
    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>
    <br>
    <blockquote
      cite="mid:11F3D334-D82D-42CF-A2CF-2740F57EF9DE@mascanc.net"
      type="cite">
      <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>
    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>
    <br>
    <blockquote
      cite="mid:11F3D334-D82D-42CF-A2CF-2740F57EF9DE@mascanc.net"
      type="cite">
      <div class=""><br class="">
      </div>
      <div class="">Setting the system property on the
        DocumentBuilderFactory makes wildfly unhappy
        (ClassNotFoundExceptions). </div>
      <br>
    </blockquote>
    <br>
    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>
    <br>
  </body>
</html>