Ill throe this in, but i might be out in left field (or iut in da weeds)But 
this is a difference between axiom and DOMWhen working with JAXB and axis2 we 
had to be very specific as to which "space" we were inAxiom or DOM
you cant just cast between them
Rick Brown
    On Wednesday, September 27, 2023 at 01:30:53 PM CDT, robertlazarski 
<robertlazar...@gmail.com> wrote:  
 
 I'm the VP of the Apache Axis project and on the PMC of the Apache Axiom 
project, and I am trying to upgrade the Axis sub project Apache Rampart project 
- last released in 2017 - to modern dependencies. 

My environment is JDK 17 on Linux with a compiler target of JDK 11.  
I mention all this because I have a Rampart unit test that I am trying to fix. 
The code compiles fine, git history shows this code has no recent changes in 
the area and just always worked. 
However, there is now a ClassCastException running a unit test when casting as 
shown. 
import org.apache.axiom.om.OMElement;import org.apache.axiom.om.OMNode;
import org.w3c.dom.Element;
// defined as <wst:RequestedSecurityToken>OMElement 
requestedSecurityTokenElement = ...// OpenSAML assertion defined as <saml> with 
org.w3c.dom.Element Element assertionElement = assertion.getDOM();
// Boom! 
requestedSecurityTokenElement.addChild((OMNode)assertionElement);

Error: 

java.lang.ClassCastException: class org.apache.xerces.dom.ElementNSImpl cannot 
be cast to class org.apache.axiom.om.OMNode 
(org.apache.xerces.dom.ElementNSImpl and org.apache.axiom.om.OMNode are in 
unnamed module of loader 'app') 
       at 
org.apache.rahas.impl.SAML2TokenIssuer.createRequestSecurityTokenResponse(SAML2TokenIssuer.java:242)

The code is here. 

https://github.com/apache/axis-axis2-java-rampart/blob/master/modules/rampart-trust/src/main/java/org/apache/rahas/impl/SAML2TokenIssuer.java#L242
 


I tried asking the most prolific Axiom developer for help in the issue below a 
few weeks ago but got no response. 


https://issues.apache.org/jira/browse/RAMPART-449

I am asking here because I am stuck and need some type of guidance. 

  

Reply via email to