You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by "Shah, Sumit (CGI Federal)" <Su...@cgifederal.com> on 2013/03/12 16:15:52 UTC

java.lang.ClassCastException: org.apache.axiom.om.impl.llom.OMElementImpl cannot be cast to org.apache.axiom.soap.SOAPFaultDetail

Hi,

I am running into the following ClassCastException running Axis2 1.6.2 and Axiom 1.2.14 (I have also included the axiom-compat jar for backwards compatibility). I noticed a similar issue reported for Synapse/Carbon https://wso2.org/jira/browse/CARBON-13759. I am not sure if these are related.


java.lang.ClassCastException: org.apache.axiom.om.impl.llom.OMElementImpl cannot be cast to org.apache.axiom.soap.SOAPFaultDetail

Its occurring here in the SOAP11FaultImpl:

public SOAPFaultDetail getDetail() {
        return (SOAPFaultDetail) getFirstChildWithName(SOAP11Constants.QNAME_FAULT_DETAIL);
}

I see that getFirstChildWithName() currently returns an OMELement, however the cast above fails. I would appreciate any suggestions.

Thanks
Sumit

RE: java.lang.ClassCastException: org.apache.axiom.om.impl.llom.OMElementImpl cannot be cast to org.apache.axiom.soap.SOAPFaultDetail

Posted by "Shah, Sumit (CGI Federal)" <Su...@cgifederal.com>.
Thanks Andreas...I will try your suggestion.

-----Original Message-----
From: Andreas Veithen [mailto:andreas.veithen@gmail.com] 
Sent: Saturday, March 16, 2013 2:47 PM
To: java-user
Subject: Re: java.lang.ClassCastException: org.apache.axiom.om.impl.llom.OMElementImpl cannot be cast to org.apache.axiom.soap.SOAPFaultDetail

Could you insert some code that calls
soapFault.getFirstChildWithName(SOAP11Constants.QNAME_FAULT_DETAIL)
and try to determine where the returned OMElement is coming from? It obviously can't be the one returned by
axisFault.getFaultDetailElement() because that one must be a SOAPFaultDetail.

Andreas

On Fri, Mar 15, 2013 at 10:03 PM, Shah, Sumit (CGI Federal) <Su...@cgifederal.com> wrote:
> Hi Andreas,
>
> This is how I create the SOAP Fault. This is using Axiom 1.2.13. I am not sure if this has changed in 1.2.14.
>
>                 catch (AxisFault axisFault) {
>                         if (axisFault.getFaultMessageContext() != null && axisFault.getFaultMessageContext().getEnvelope() != null) {
>                             SOAPFault soapFault = null;
>
>                             if (axisFault.getFaultMessageContext().isSOAP11()) {
>                                 soapFault = new SOAP11Factory().createSOAPFault(axisFault.getFaultMessageContext().getEnvelope().getBody());
>                             }
>                             else {
>                                 soapFault = new 
> SOAP12Factory().createSOAPFault(axisFault.getFaultMessageContext().get
> Envelope().getBody());
>
>                                 if (axisFault.getFaultNodeElement() != null) {
>                                     soapFault.setNode(axisFault.getFaultNodeElement());
>                                 }
>                             }
>
>                             if (axisFault.getFaultCodeElement() != null) {
>                                 soapFault.setCode(axisFault.getFaultCodeElement());
>                             }
>
>                             if (axisFault.getFaultDetailElement() != null) {
>                                 soapFault.setDetail(axisFault.getFaultDetailElement());
>                             }
>
>                             if (axisFault.getFaultReasonElement() != null) {
>                                 soapFault.setReason(axisFault.getFaultReasonElement());
>                             }
>
>                             if (axisFault.getFaultRoleElement() != null) {
>                                 soapFault.setRole(axisFault.getFaultRoleElement());
>                             }
>
>                                         //This get called
>                             this.handleSOAPFault(method, soapFault);
>                         }
>                         else {
>                             throw axisFault;
>                         }
>                 }
>
>
> The CCE happens in the method here:
> protected void handleSOAPFault(Method method, SOAPFault soapFault) throws Exception {
>         Exception faultException = null;
>
>           //The ClassCastException is a result of this call
>         if (soapFault.getDetail() != null) {
>             Map<String, Object> jaxbContextProperties = null;
>
> //other logic removed for brevity.
> }
>
> Thanks
> Sumit
>
> -----Original Message-----
> From: Andreas Veithen [mailto:andreas.veithen@gmail.com]
> Sent: Wednesday, March 13, 2013 12:25 PM
> To: java-user
> Subject: Re: java.lang.ClassCastException: 
> org.apache.axiom.om.impl.llom.OMElementImpl cannot be cast to 
> org.apache.axiom.soap.SOAPFaultDetail
>
> How is the SOAPFault created?
>
> Andreas
>
> On Wed, Mar 13, 2013 at 3:19 PM, Shah, Sumit (CGI Federal) <Su...@cgifederal.com> wrote:
>> Thanks Yashwanth. It seems like this is an issue in Axiom 1.2.14, 
>> because both the SOAPFault11Impl and OMElementImpl are classes in 
>> Axiom 1.2.14. Does this mean this a bug?
>>
>>
>>
>> Sumit
>>
>>
>>
>> From: Yashwanth Rajaram -X (yrajaram - ZENSAR TECHNOLOGIES INC at
>> Cisco) [mailto:yrajaram@cisco.com]
>> Sent: Tuesday, March 12, 2013 1:35 PM
>> To: java-user@axis.apache.org
>> Subject: RE: java.lang.ClassCastException:
>> org.apache.axiom.om.impl.llom.OMElementImpl cannot be cast to 
>> org.apache.axiom.soap.SOAPFaultDetail
>>
>>
>>
>> Sumit, I think you might have to do something like this:
>>
>>
>>
>> SOAPFaultDetail detail =
>> OMAbstractFactory.getSOAP11Factory().createSOAPFaultDetail();
>>
>> detail.addChild(getFirstChildWithName(SOAP11Constants.QNAME_FAULT_DET
>> A
>> IL));
>>
>>
>>
>> Sincerely, Yashwanth
>>
>> Technical Architect, EBIS
>>
>>
>>
>> From: Shah, Sumit (CGI Federal) [mailto:Sumit.Shah@cgifederal.com]
>> Sent: Tuesday, March 12, 2013 8:16 AM
>> To: java-user@axis.apache.org
>> Subject: java.lang.ClassCastException:
>> org.apache.axiom.om.impl.llom.OMElementImpl cannot be cast to 
>> org.apache.axiom.soap.SOAPFaultDetail
>>
>>
>>
>> Hi,
>>
>>
>>
>> I am running into the following ClassCastException running Axis2 
>> 1.6.2 and Axiom 1.2.14 (I have also included the axiom-compat jar for 
>> backwards compatibility). I noticed a similar issue reported for 
>> Synapse/Carbon https://wso2.org/jira/browse/CARBON-13759. I am not 
>> sure if these are related.
>>
>>
>>
>>
>>
>> java.lang.ClassCastException:
>> org.apache.axiom.om.impl.llom.OMElementImpl
>> cannot be cast to org.apache.axiom.soap.SOAPFaultDetail
>>
>>
>>
>> Its occurring here in the SOAP11FaultImpl:
>>
>>
>>
>> public SOAPFaultDetail getDetail() {
>>
>>         return (SOAPFaultDetail)
>> getFirstChildWithName(SOAP11Constants.QNAME_FAULT_DETAIL);
>>
>> }
>>
>>
>>
>> I see that getFirstChildWithName() currently returns an OMELement, 
>> however the cast above fails. I would appreciate any suggestions.
>>
>>
>>
>> Thanks
>>
>> Sumit
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


Re: java.lang.ClassCastException: org.apache.axiom.om.impl.llom.OMElementImpl cannot be cast to org.apache.axiom.soap.SOAPFaultDetail

Posted by Andreas Veithen <an...@gmail.com>.
Could you insert some code that calls
soapFault.getFirstChildWithName(SOAP11Constants.QNAME_FAULT_DETAIL)
and try to determine where the returned OMElement is coming from? It
obviously can't be the one returned by
axisFault.getFaultDetailElement() because that one must be a
SOAPFaultDetail.

Andreas

On Fri, Mar 15, 2013 at 10:03 PM, Shah, Sumit (CGI Federal)
<Su...@cgifederal.com> wrote:
> Hi Andreas,
>
> This is how I create the SOAP Fault. This is using Axiom 1.2.13. I am not sure if this has changed in 1.2.14.
>
>                 catch (AxisFault axisFault) {
>                         if (axisFault.getFaultMessageContext() != null && axisFault.getFaultMessageContext().getEnvelope() != null) {
>                             SOAPFault soapFault = null;
>
>                             if (axisFault.getFaultMessageContext().isSOAP11()) {
>                                 soapFault = new SOAP11Factory().createSOAPFault(axisFault.getFaultMessageContext().getEnvelope().getBody());
>                             }
>                             else {
>                                 soapFault = new SOAP12Factory().createSOAPFault(axisFault.getFaultMessageContext().getEnvelope().getBody());
>
>                                 if (axisFault.getFaultNodeElement() != null) {
>                                     soapFault.setNode(axisFault.getFaultNodeElement());
>                                 }
>                             }
>
>                             if (axisFault.getFaultCodeElement() != null) {
>                                 soapFault.setCode(axisFault.getFaultCodeElement());
>                             }
>
>                             if (axisFault.getFaultDetailElement() != null) {
>                                 soapFault.setDetail(axisFault.getFaultDetailElement());
>                             }
>
>                             if (axisFault.getFaultReasonElement() != null) {
>                                 soapFault.setReason(axisFault.getFaultReasonElement());
>                             }
>
>                             if (axisFault.getFaultRoleElement() != null) {
>                                 soapFault.setRole(axisFault.getFaultRoleElement());
>                             }
>
>                                         //This get called
>                             this.handleSOAPFault(method, soapFault);
>                         }
>                         else {
>                             throw axisFault;
>                         }
>                 }
>
>
> The CCE happens in the method here:
> protected void handleSOAPFault(Method method, SOAPFault soapFault) throws Exception {
>         Exception faultException = null;
>
>           //The ClassCastException is a result of this call
>         if (soapFault.getDetail() != null) {
>             Map<String, Object> jaxbContextProperties = null;
>
> //other logic removed for brevity.
> }
>
> Thanks
> Sumit
>
> -----Original Message-----
> From: Andreas Veithen [mailto:andreas.veithen@gmail.com]
> Sent: Wednesday, March 13, 2013 12:25 PM
> To: java-user
> Subject: Re: java.lang.ClassCastException: org.apache.axiom.om.impl.llom.OMElementImpl cannot be cast to org.apache.axiom.soap.SOAPFaultDetail
>
> How is the SOAPFault created?
>
> Andreas
>
> On Wed, Mar 13, 2013 at 3:19 PM, Shah, Sumit (CGI Federal) <Su...@cgifederal.com> wrote:
>> Thanks Yashwanth. It seems like this is an issue in Axiom 1.2.14,
>> because both the SOAPFault11Impl and OMElementImpl are classes in
>> Axiom 1.2.14. Does this mean this a bug?
>>
>>
>>
>> Sumit
>>
>>
>>
>> From: Yashwanth Rajaram -X (yrajaram - ZENSAR TECHNOLOGIES INC at
>> Cisco) [mailto:yrajaram@cisco.com]
>> Sent: Tuesday, March 12, 2013 1:35 PM
>> To: java-user@axis.apache.org
>> Subject: RE: java.lang.ClassCastException:
>> org.apache.axiom.om.impl.llom.OMElementImpl cannot be cast to
>> org.apache.axiom.soap.SOAPFaultDetail
>>
>>
>>
>> Sumit, I think you might have to do something like this:
>>
>>
>>
>> SOAPFaultDetail detail =
>> OMAbstractFactory.getSOAP11Factory().createSOAPFaultDetail();
>>
>> detail.addChild(getFirstChildWithName(SOAP11Constants.QNAME_FAULT_DETA
>> IL));
>>
>>
>>
>> Sincerely, Yashwanth
>>
>> Technical Architect, EBIS
>>
>>
>>
>> From: Shah, Sumit (CGI Federal) [mailto:Sumit.Shah@cgifederal.com]
>> Sent: Tuesday, March 12, 2013 8:16 AM
>> To: java-user@axis.apache.org
>> Subject: java.lang.ClassCastException:
>> org.apache.axiom.om.impl.llom.OMElementImpl cannot be cast to
>> org.apache.axiom.soap.SOAPFaultDetail
>>
>>
>>
>> Hi,
>>
>>
>>
>> I am running into the following ClassCastException running Axis2 1.6.2
>> and Axiom 1.2.14 (I have also included the axiom-compat jar for
>> backwards compatibility). I noticed a similar issue reported for
>> Synapse/Carbon https://wso2.org/jira/browse/CARBON-13759. I am not
>> sure if these are related.
>>
>>
>>
>>
>>
>> java.lang.ClassCastException:
>> org.apache.axiom.om.impl.llom.OMElementImpl
>> cannot be cast to org.apache.axiom.soap.SOAPFaultDetail
>>
>>
>>
>> Its occurring here in the SOAP11FaultImpl:
>>
>>
>>
>> public SOAPFaultDetail getDetail() {
>>
>>         return (SOAPFaultDetail)
>> getFirstChildWithName(SOAP11Constants.QNAME_FAULT_DETAIL);
>>
>> }
>>
>>
>>
>> I see that getFirstChildWithName() currently returns an OMELement,
>> however the cast above fails. I would appreciate any suggestions.
>>
>>
>>
>> Thanks
>>
>> Sumit
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


RE: java.lang.ClassCastException: org.apache.axiom.om.impl.llom.OMElementImpl cannot be cast to org.apache.axiom.soap.SOAPFaultDetail

Posted by "Shah, Sumit (CGI Federal)" <Su...@cgifederal.com>.
Hi Andreas,

This is how I create the SOAP Fault. This is using Axiom 1.2.13. I am not sure if this has changed in 1.2.14.

		catch (AxisFault axisFault) {
                        if (axisFault.getFaultMessageContext() != null && axisFault.getFaultMessageContext().getEnvelope() != null) {
                            SOAPFault soapFault = null;

                            if (axisFault.getFaultMessageContext().isSOAP11()) {
                                soapFault = new SOAP11Factory().createSOAPFault(axisFault.getFaultMessageContext().getEnvelope().getBody());
                            }
                            else {
                                soapFault = new SOAP12Factory().createSOAPFault(axisFault.getFaultMessageContext().getEnvelope().getBody());

                                if (axisFault.getFaultNodeElement() != null) {
                                    soapFault.setNode(axisFault.getFaultNodeElement());
                                }
                            }

                            if (axisFault.getFaultCodeElement() != null) {
                                soapFault.setCode(axisFault.getFaultCodeElement());
                            }

                            if (axisFault.getFaultDetailElement() != null) {
                                soapFault.setDetail(axisFault.getFaultDetailElement());
                            }

                            if (axisFault.getFaultReasonElement() != null) {
                                soapFault.setReason(axisFault.getFaultReasonElement());
                            }

                            if (axisFault.getFaultRoleElement() != null) {
                                soapFault.setRole(axisFault.getFaultRoleElement());
                            }

					//This get called
                            this.handleSOAPFault(method, soapFault);
                        }
                        else {
                            throw axisFault;
                        }
		} 


The CCE happens in the method here:
protected void handleSOAPFault(Method method, SOAPFault soapFault) throws Exception {
        Exception faultException = null;

	  //The ClassCastException is a result of this call
        if (soapFault.getDetail() != null) {
            Map<String, Object> jaxbContextProperties = null;

//other logic removed for brevity.
}

Thanks
Sumit

-----Original Message-----
From: Andreas Veithen [mailto:andreas.veithen@gmail.com] 
Sent: Wednesday, March 13, 2013 12:25 PM
To: java-user
Subject: Re: java.lang.ClassCastException: org.apache.axiom.om.impl.llom.OMElementImpl cannot be cast to org.apache.axiom.soap.SOAPFaultDetail

How is the SOAPFault created?

Andreas

On Wed, Mar 13, 2013 at 3:19 PM, Shah, Sumit (CGI Federal) <Su...@cgifederal.com> wrote:
> Thanks Yashwanth. It seems like this is an issue in Axiom 1.2.14, 
> because both the SOAPFault11Impl and OMElementImpl are classes in 
> Axiom 1.2.14. Does this mean this a bug?
>
>
>
> Sumit
>
>
>
> From: Yashwanth Rajaram -X (yrajaram - ZENSAR TECHNOLOGIES INC at 
> Cisco) [mailto:yrajaram@cisco.com]
> Sent: Tuesday, March 12, 2013 1:35 PM
> To: java-user@axis.apache.org
> Subject: RE: java.lang.ClassCastException:
> org.apache.axiom.om.impl.llom.OMElementImpl cannot be cast to 
> org.apache.axiom.soap.SOAPFaultDetail
>
>
>
> Sumit, I think you might have to do something like this:
>
>
>
> SOAPFaultDetail detail =
> OMAbstractFactory.getSOAP11Factory().createSOAPFaultDetail();
>
> detail.addChild(getFirstChildWithName(SOAP11Constants.QNAME_FAULT_DETA
> IL));
>
>
>
> Sincerely, Yashwanth
>
> Technical Architect, EBIS
>
>
>
> From: Shah, Sumit (CGI Federal) [mailto:Sumit.Shah@cgifederal.com]
> Sent: Tuesday, March 12, 2013 8:16 AM
> To: java-user@axis.apache.org
> Subject: java.lang.ClassCastException:
> org.apache.axiom.om.impl.llom.OMElementImpl cannot be cast to 
> org.apache.axiom.soap.SOAPFaultDetail
>
>
>
> Hi,
>
>
>
> I am running into the following ClassCastException running Axis2 1.6.2 
> and Axiom 1.2.14 (I have also included the axiom-compat jar for 
> backwards compatibility). I noticed a similar issue reported for 
> Synapse/Carbon https://wso2.org/jira/browse/CARBON-13759. I am not 
> sure if these are related.
>
>
>
>
>
> java.lang.ClassCastException: 
> org.apache.axiom.om.impl.llom.OMElementImpl
> cannot be cast to org.apache.axiom.soap.SOAPFaultDetail
>
>
>
> Its occurring here in the SOAP11FaultImpl:
>
>
>
> public SOAPFaultDetail getDetail() {
>
>         return (SOAPFaultDetail)
> getFirstChildWithName(SOAP11Constants.QNAME_FAULT_DETAIL);
>
> }
>
>
>
> I see that getFirstChildWithName() currently returns an OMELement, 
> however the cast above fails. I would appreciate any suggestions.
>
>
>
> Thanks
>
> Sumit

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


Re: java.lang.ClassCastException: org.apache.axiom.om.impl.llom.OMElementImpl cannot be cast to org.apache.axiom.soap.SOAPFaultDetail

Posted by Andreas Veithen <an...@gmail.com>.
How is the SOAPFault created?

Andreas

On Wed, Mar 13, 2013 at 3:19 PM, Shah, Sumit (CGI Federal)
<Su...@cgifederal.com> wrote:
> Thanks Yashwanth. It seems like this is an issue in Axiom 1.2.14, because
> both the SOAPFault11Impl and OMElementImpl are classes in Axiom 1.2.14. Does
> this mean this a bug?
>
>
>
> Sumit
>
>
>
> From: Yashwanth Rajaram -X (yrajaram - ZENSAR TECHNOLOGIES INC at Cisco)
> [mailto:yrajaram@cisco.com]
> Sent: Tuesday, March 12, 2013 1:35 PM
> To: java-user@axis.apache.org
> Subject: RE: java.lang.ClassCastException:
> org.apache.axiom.om.impl.llom.OMElementImpl cannot be cast to
> org.apache.axiom.soap.SOAPFaultDetail
>
>
>
> Sumit, I think you might have to do something like this:
>
>
>
> SOAPFaultDetail detail =
> OMAbstractFactory.getSOAP11Factory().createSOAPFaultDetail();
>
> detail.addChild(getFirstChildWithName(SOAP11Constants.QNAME_FAULT_DETAIL));
>
>
>
> Sincerely, Yashwanth
>
> Technical Architect, EBIS
>
>
>
> From: Shah, Sumit (CGI Federal) [mailto:Sumit.Shah@cgifederal.com]
> Sent: Tuesday, March 12, 2013 8:16 AM
> To: java-user@axis.apache.org
> Subject: java.lang.ClassCastException:
> org.apache.axiom.om.impl.llom.OMElementImpl cannot be cast to
> org.apache.axiom.soap.SOAPFaultDetail
>
>
>
> Hi,
>
>
>
> I am running into the following ClassCastException running Axis2 1.6.2 and
> Axiom 1.2.14 (I have also included the axiom-compat jar for backwards
> compatibility). I noticed a similar issue reported for Synapse/Carbon
> https://wso2.org/jira/browse/CARBON-13759. I am not sure if these are
> related.
>
>
>
>
>
> java.lang.ClassCastException: org.apache.axiom.om.impl.llom.OMElementImpl
> cannot be cast to org.apache.axiom.soap.SOAPFaultDetail
>
>
>
> Its occurring here in the SOAP11FaultImpl:
>
>
>
> public SOAPFaultDetail getDetail() {
>
>         return (SOAPFaultDetail)
> getFirstChildWithName(SOAP11Constants.QNAME_FAULT_DETAIL);
>
> }
>
>
>
> I see that getFirstChildWithName() currently returns an OMELement, however
> the cast above fails. I would appreciate any suggestions.
>
>
>
> Thanks
>
> Sumit

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


RE: java.lang.ClassCastException: org.apache.axiom.om.impl.llom.OMElementImpl cannot be cast to org.apache.axiom.soap.SOAPFaultDetail

Posted by "Shah, Sumit (CGI Federal)" <Su...@cgifederal.com>.
Thanks Yashwanth. It seems like this is an issue in Axiom 1.2.14, because both the SOAPFault11Impl and OMElementImpl are classes in Axiom 1.2.14. Does this mean this a bug?

Sumit

From: Yashwanth Rajaram -X (yrajaram - ZENSAR TECHNOLOGIES INC at Cisco) [mailto:yrajaram@cisco.com]
Sent: Tuesday, March 12, 2013 1:35 PM
To: java-user@axis.apache.org
Subject: RE: java.lang.ClassCastException: org.apache.axiom.om.impl.llom.OMElementImpl cannot be cast to org.apache.axiom.soap.SOAPFaultDetail

Sumit, I think you might have to do something like this:


SOAPFaultDetail detail = OMAbstractFactory.getSOAP11Factory().createSOAPFaultDetail();

detail.addChild(getFirstChildWithName(SOAP11Constants.QNAME_FAULT_DETAIL));

Sincerely, Yashwanth
Technical Architect, EBIS

From: Shah, Sumit (CGI Federal) [mailto:Sumit.Shah@cgifederal.com]
Sent: Tuesday, March 12, 2013 8:16 AM
To: java-user@axis.apache.org<ma...@axis.apache.org>
Subject: java.lang.ClassCastException: org.apache.axiom.om.impl.llom.OMElementImpl cannot be cast to org.apache.axiom.soap.SOAPFaultDetail

Hi,

I am running into the following ClassCastException running Axis2 1.6.2 and Axiom 1.2.14 (I have also included the axiom-compat jar for backwards compatibility). I noticed a similar issue reported for Synapse/Carbon https://wso2.org/jira/browse/CARBON-13759. I am not sure if these are related.


java.lang.ClassCastException: org.apache.axiom.om.impl.llom.OMElementImpl cannot be cast to org.apache.axiom.soap.SOAPFaultDetail

Its occurring here in the SOAP11FaultImpl:

public SOAPFaultDetail getDetail() {
        return (SOAPFaultDetail) getFirstChildWithName(SOAP11Constants.QNAME_FAULT_DETAIL);
}

I see that getFirstChildWithName() currently returns an OMELement, however the cast above fails. I would appreciate any suggestions.

Thanks
Sumit

RE: java.lang.ClassCastException: org.apache.axiom.om.impl.llom.OMElementImpl cannot be cast to org.apache.axiom.soap.SOAPFaultDetail

Posted by "Yashwanth Rajaram -X (yrajaram - ZENSAR TECHNOLOGIES INC at Cisco)" <yr...@cisco.com>.
Sumit, I think you might have to do something like this:


SOAPFaultDetail detail = OMAbstractFactory.getSOAP11Factory().createSOAPFaultDetail();

detail.addChild(getFirstChildWithName(SOAP11Constants.QNAME_FAULT_DETAIL));

Sincerely, Yashwanth
Technical Architect, EBIS

From: Shah, Sumit (CGI Federal) [mailto:Sumit.Shah@cgifederal.com]
Sent: Tuesday, March 12, 2013 8:16 AM
To: java-user@axis.apache.org
Subject: java.lang.ClassCastException: org.apache.axiom.om.impl.llom.OMElementImpl cannot be cast to org.apache.axiom.soap.SOAPFaultDetail

Hi,

I am running into the following ClassCastException running Axis2 1.6.2 and Axiom 1.2.14 (I have also included the axiom-compat jar for backwards compatibility). I noticed a similar issue reported for Synapse/Carbon https://wso2.org/jira/browse/CARBON-13759. I am not sure if these are related.


java.lang.ClassCastException: org.apache.axiom.om.impl.llom.OMElementImpl cannot be cast to org.apache.axiom.soap.SOAPFaultDetail

Its occurring here in the SOAP11FaultImpl:

public SOAPFaultDetail getDetail() {
        return (SOAPFaultDetail) getFirstChildWithName(SOAP11Constants.QNAME_FAULT_DETAIL);
}

I see that getFirstChildWithName() currently returns an OMELement, however the cast above fails. I would appreciate any suggestions.

Thanks
Sumit