XML Implementation issues

Massimiliano Masi max at mascanc.net
Tue Aug 9 11:51:19 EDT 2016


Hi All, 

I am running java 1.8 and wildfly 9. I have some issues with the DOM implementation, opensaml 2.6.1. 

My soap message is handled by saaj. When I get the SOAP header, and I unmarshall it, the DOM is 

com.sun.xml.messaging.saaj.soap.impl.ElementImpl 

(from getDOM() of Assertion). 

Its internal representation is

com.sun.org.apache.xerces.internal.dom.DOMImplementationImpl.

Now, it seems that this is somehow forced by saaj. 

Then I try to marshall the assertion, the following line of codes 
System.out.println("WSSecSAML2TOken" + Configuration.getParserPool().getBuilder().getDOMImplementation());
if (saml.getDOM()!=null){
					
	System.out.println("WSSecSAML2TOken1" + saml.getDOM().getClass());
	System.out.println("WSSecSAML2TOken2" + saml.getDOM().getOwnerDocument().getImplementation().getClass());
}

return respectively

2016-08-09 17:46:38,513 INFO  [stdout] WSSecSAML2TOkenorg.apache.xerces.dom.DOMImplementationImpl at 57944aac
2016-08-09 17:46:38,513 INFO  [stdout] WSSecSAML2TOken1class com.sun.xml.messaging.saaj.soap.impl.ElementImpl
2016-08-09 17:46:38,514 INFO  [stdout] WSSecSAML2TOken2class com.sun.org.apache.xerces.internal.dom.DOMImplementationImpl


which causes the following classcastexception: 

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!/
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
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
2016-08-09 17:46:38,515 ERROR [stderr] 	at org.apache.xerces.dom.CoreDocumentImpl.adoptNode(CoreDocumentImpl.java:1760)
2016-08-09 17:46:38,515 ERROR [stderr] 	at org.opensaml.xml.util.XMLHelper.adoptElement(XMLHelper.java:545)
2016-08-09 17:46:38,516 ERROR [stderr] 	at org.opensaml.xml.io.AbstractXMLObjectMarshaller.marshall(AbstractXMLObjectMarshaller.java:111)
2016-08-09 17:46:38,516 ERROR [stderr] 	at org.opensaml.common.impl.AbstractSAMLObjectMarshaller.marshall(AbstractSAMLObjectMarshaller.java:59)
2016-08-09 17:46:38,516 ERROR [stderr] 	at org.opensaml.xml.io.AbstractXMLObjectMarshaller.marshall(AbstractXMLObjectMarshaller.java:85)

(I added the printStackTrace to xerces). Thus, it seems that the XMLObject keeps the original DOM implementation, returning a “DOM Element node adoption failed”. 

Now, I really don’t know how to proceed. Any hints on aligning the DOM implementations? Before, with java6 and 
jboss4, I was used to the endorsing mechanism, but in java8 + wildfly9 it does not seem to have any effect.

Setting the system property on the DocumentBuilderFactory makes wildfly unhappy (ClassNotFoundExceptions). 

Any hints?


Ciao, 

	Massi


--
Anger is a gift, http://www.mascanc.net/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shibboleth.net/pipermail/dev/attachments/20160809/fa86a00f/attachment.html>


More information about the dev mailing list