<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">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><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><div class="">(from getDOM() of Assertion). </div><div class=""><br class=""></div><div class="">Its internal representation is</div><div class=""><br class=""></div><div class="">com.sun.org.apache.xerces.internal.dom.DOMImplementationImpl.</div><div class=""><br class=""></div><div class="">Now, it seems that this is somehow forced by saaj. </div><div class=""><br class=""></div><div class="">Then I try to marshall the assertion, the following line of codes </div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco;" class="">System.<span style="color: #0326cc" class="">out</span>.println(<span style="color: #3933ff" class="">"WSSecSAML2TOken"</span> + Configuration.getParserPool().getBuilder().getDOMImplementation());</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco;" class=""><span style="color: rgb(147, 26, 104);" class="">if</span> (<span style="color: rgb(3, 38, 204);" class="">saml</span>.getDOM()!=<span style="color: rgb(147, 26, 104);" class="">null</span>){</div><p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; min-height: 15px;" class=""><span class="Apple-tab-span" style="white-space:pre">                                     </span><br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco;" class=""><span class="Apple-tab-span" style="white-space:pre">     </span>System.<span style="color: #0326cc" class="">out</span>.println(<span style="color: #3933ff" class="">"WSSecSAML2TOken1"</span> + <span style="color: #0326cc" class="">saml</span>.getDOM().getClass());</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco;" class=""><span class="Apple-tab-span" style="white-space:pre">     </span>System.<span style="color: #0326cc" class="">out</span>.println(<span style="color: #3933ff" class="">"WSSecSAML2TOken2"</span> + <span style="color: #0326cc" class="">saml</span>.getDOM().getOwnerDocument().getImplementation().getClass());</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; min-height: 15px;" class="">}</div></div><div class=""><br class=""></div><div class="">return respectively</div><div class=""><br class=""></div><div class=""><div class="">2016-08-09 17:46:38,513 INFO  [stdout] WSSecSAML2TOkenorg.apache.xerces.dom.DOMImplementationImpl@57944aac</div><div class="">2016-08-09 17:46:38,513 INFO  [stdout] WSSecSAML2TOken1class com.sun.xml.messaging.saaj.soap.impl.ElementImpl</div><div class="">2016-08-09 17:46:38,514 INFO  [stdout] WSSecSAML2TOken2class com.sun.org.apache.xerces.internal.dom.DOMImplementationImpl</div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">which causes the following classcastexception: </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: jar:file:/opt/bin/jboss1/modules/system/layers/base/com/main/xercesImpl-debug.2.9.1.jar!/</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 class="">2016-08-09 17:46:38,516 ERROR [stderr] <span class="Apple-tab-span" style="white-space:pre">        </span>at org.opensaml.xml.io.AbstractXMLObjectMarshaller.marshall(AbstractXMLObjectMarshaller.java:111)</div><div class="">2016-08-09 17:46:38,516 ERROR [stderr] <span class="Apple-tab-span" style="white-space:pre">  </span>at org.opensaml.common.impl.AbstractSAMLObjectMarshaller.marshall(AbstractSAMLObjectMarshaller.java:59)</div><div class="">2016-08-09 17:46:38,516 ERROR [stderr] <span class="Apple-tab-span" style="white-space:pre">    </span>at org.opensaml.xml.io.AbstractXMLObjectMarshaller.marshall(AbstractXMLObjectMarshaller.java:85)</div></div><div class=""><br class=""></div><div class="">(I added the printStackTrace to xerces). Thus, it seems that the XMLObject keeps the original DOM implementation, returning a “DOM Element node adoption failed”. </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><div class=""><br class=""></div><div class="">Setting the system property on the DocumentBuilderFactory makes wildfly unhappy (ClassNotFoundExceptions). </div><div class=""><br class=""></div><div class="">Any hints?</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Ciao, </div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>Massi</div><div class=""><br class=""></div><div class=""><br class=""></div><div 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>