[ 
https://issues.apache.org/jira/browse/AXIS2-4363?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12715696#action_12715696
 ] 

Andreas Veithen commented on AXIS2-4363:
----------------------------------------

The problem is caused by the fact that some parts of Axis2 code directly use 
org.apache.axiom.om.impl.llom.OMStAXWrapper. This needs to be changed so that 
the code refers to the corresponding interface(s), i.e. OMXMLStreamReader and 
OMAttachmentAccessor. There are actually several reasons for this:

1. If the log level is set to DEBUG, OMElementImpl#getXMLStreamReader wraps the 
OMStAXWrapper in a OMXMLStreamReaderValidator. This causes the issue described 
above.
2. org.apache.axiom.om.impl.llom.OMStAXWrapper is part of axiom-impl (the LLOM 
implementation of Axiom), but Axis2 should ideally only refer to axiom-api.
3. It's against the programming-to-interface paradigm.
4. In Axiom trunk, OMStAXWrapper has been merged with the corresponding class 
from the DOOM implementation and now lives in axiom-api (as 
org.apache.axiom.om.impl.OMStAXWrapper). 
org.apache.axiom.om.impl.llom.OMStAXWrapper still exists, but only for 
compatibility reasons. It would be great if we could eliminate it on the longer 
term.

Files in Axis2 that refer to org.apache.axiom.om.impl.llom.OMStAXWrapper:

modules/adb/src/org/apache/axis2/databinding/types/soapencoding/Base64Binary.java
modules/adb/src/org/apache/axis2/databinding/types/xsd/Base64Binary.java
modules/adb/src/org/apache/axis2/databinding/utils/ConverterUtil.java
modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl -> 
this means that wsdl2java generates code that refers to 
org.apache.axiom.om.impl.llom.OMStAXWrapper


> Classcast exception when enabling MTOM with ADB 
> ------------------------------------------------
>
>                 Key: AXIS2-4363
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4363
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>    Affects Versions: 1.4.1
>         Environment: ADB databinding
>            Reporter: Julien Henry
>            Assignee: Andreas Veithen
>
> When enabling MTOM and generating client stub with ADB, I get the following 
> error when using my WS to download attachments:
> {code}
> java.lang.ClassCastException:
> org.apache.axiom.om.util.OMXMLStreamReaderValidator cannot be cast to 
> org.apache.axiom.om.impl.llom.OMStAXWrapper
>   at 
> com.xxx.vaultwebservice.client.Vault_WebServiceStub$XXXBundleType$Factory.parse(Vault_WebServiceStub.java:21236)
>   at 
> com.xxx.vaultwebservice.client.Vault_WebServiceStub$DownloadXXXResponse$Factory.parse(Vault_WebServiceStub.java:56454)
>   at 
> com.xxx.vaultwebservice.client.Vault_WebServiceStub.fromOM(Vault_WebServiceStub.java:64390)
> {code}
> This error only occurs when log level for org.apache.axiom is DEBUG so a 
> workaround is to set log level > DEBUG.
> The bug is also present with staged 1.5 version.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to