You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by pchakinala <pr...@planetsoft.com> on 2011/04/25 15:55:11 UTC

java.lang.ClassCastException: com.sun.org.apache.xerces.internal.dom.DocumentImpl cannot be cast to com.sun.xml.messaging.saaj.soap.SOAPDocument

Hi,
 I am working with Apache servicemix 4.3 to expose/call webservices.It
internally using CXF 2.3.2 and Open saml 1.1 to implement security.
My usecase flow is like below.
  http client ----> cxfbc provider --->call webservice

  CXF Configuration:
---------------------

<cxfbc:provider wsdl="classpath:service.wsdl"
        locationURI="http://localhost:2000/orderapp/OrderProcess"
                  service="tns:OrderProcessImplService"
        endpoint="OrderProcessPort"
                useJBIWrapper="false"
                useSOAPEnvelope="false">
       <cxfbc:outInterceptors>

       <bean id="logout"
class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
          <bean id="saajout"
class="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor"/> 
          <bean id="wss4jout"
class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
              <constructor-arg>
                  <map>
                                        <entry key="action" value="Signature
SAMLTokenSigned"/>
                                                <entry key="user"
value="myAlias" />
                                                          <entry
key="passwordType" value="PasswordText"/>
                                        <entry key="samlPropFile"
value="client_saml.properties"/> 
                                         <entry key="signaturePropFile"
value="hub_client_sign.properties"/> 
                                        <entry>
                                                 <key>
                                               
<value>passwordCallbackRef</value>
                                                </key>
                                                <ref
bean="passwordCallback"/>
                                                </entry> 
                                                <entry
key="enableNamespacePrefixOptimization" value="true"/>
                                                <entry
key="disablePrettyXML" value="true"/>
                                                <entry key="sendXsiTypes"
value="true"/>
                                                <entry key="sendMultiRefs"
value="true"/>
                                                <entry
key="sendXMLDeclaration" value="true"/>
                 </map>
              </constructor-arg>
          </bean>
               
 </cxfbc:outInterceptors>
 </cxfbc:provider>

I found below exception in the servicemix log file.

Checkpoint done.
18:57:25,578 | DEBUG | nitor WriteCheck | InactivityMonitor                |
43 - org.apache.activemq.activemq-core - 5.4.2 | 10000 ms elapsed since last
write check.
18:57:25,578 | DEBUG | nitor WriteCheck | InactivityMonitor                |
43 - org.apache.activemq.activemq-core - 5.4.2 | 10000 ms elapsed since last
write check.
18:57:26,343 | DEBUG | nitor WriteCheck | InactivityMonitor                |
43 - org.apache.activemq.activemq-core - 5.4.2 | 10000 ms elapsed since last
write check.
18:57:26,343 | DEBUG | nitor WriteCheck | InactivityMonitor                |
43 - org.apache.activemq.activemq-core - 5.4.2 | 10000 ms elapsed since last
write check.
18:57:27,953 | DEBUG | rovider-thread-4 | SAMLIssuerImpl                   |
113 - org.apache.ws.security.wss4j - 1.5.9 |
com.sun.org.apache.xerces.internal.dom.DocumentImpl cannot be cast to
com.sun.xml.messaging.saaj.soap.SOAPDocument
java.lang.ClassCastException:
com.sun.org.apache.xerces.internal.dom.DocumentImpl cannot be cast to
com.sun.xml.messaging.saaj.soap.SOAPDocument
	at
com.sun.xml.messaging.saaj.soap.impl.ElementImpl.getOwnerDocument(ElementImpl.java:147)[111:org.apache.servicemix.bundles.saaj-impl:1.3.2.2]
	at
com.sun.org.apache.xerces.internal.dom.ParentNode.internalInsertBefore(ParentNode.java:389)[:]
	at
com.sun.org.apache.xerces.internal.dom.ParentNode.insertBefore(ParentNode.java:322)[:]
	at
com.sun.org.apache.xerces.internal.dom.NodeImpl.appendChild(NodeImpl.java:273)[:]
	at org.opensaml.SAMLSubject.toDOM(Unknown
Source)[114:org.apache.servicemix.bundles.opensaml:1.1.0.5]
	at org.opensaml.SAMLSubjectStatement.toDOM(Unknown
Source)[114:org.apache.servicemix.bundles.opensaml:1.1.0.5]
	at org.opensaml.SAMLAuthenticationStatement.toDOM(Unknown
Source)[114:org.apache.servicemix.bundles.opensaml:1.1.0.5]
	at org.opensaml.SAMLAssertion.toDOM(Unknown
Source)[114:org.apache.servicemix.bundles.opensaml:1.1.0.5]
	at org.opensaml.SAMLObject.toDOM(Unknown
Source)[114:org.apache.servicemix.bundles.opensaml:1.1.0.5]
	at org.opensaml.SAMLSignedObject.toDOM(Unknown
Source)[114:org.apache.servicemix.bundles.opensaml:1.1.0.5]
	at org.opensaml.SAMLObject.toDOM(Unknown
Source)[114:org.apache.servicemix.bundles.opensaml:1.1.0.5]
	at org.opensaml.SAMLSignedObject.sign(Unknown
Source)[114:org.apache.servicemix.bundles.opensaml:1.1.0.5]
	at org.opensaml.SAMLSignedObject.sign(Unknown
Source)[114:org.apache.servicemix.bundles.opensaml:1.1.0.5]
	at
org.apache.ws.security.saml.SAMLIssuerImpl.newAssertion(SAMLIssuerImpl.java:237)[113:org.apache.ws.security.wss4j:1.5.9]
	at
org.apache.ws.security.action.SAMLTokenSignedAction.execute(SAMLTokenSignedAction.java:61)[113:org.apache.ws.security.wss4j:1.5.9]
	at
org.apache.ws.security.handler.WSHandler.doSenderAction(WSHandler.java:205)[113:org.apache.ws.security.wss4j:1.5.9]
	at
org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor.access$200(WSS4JOutInterceptor.java:50)[116:org.apache.cxf.bundle:2.3.2]
	at
org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor$WSS4JOutInterceptorInternal.handleMessage(WSS4JOutInterceptor.java:257)[116:org.apache.cxf.bundle:2.3.2]
	at
org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor$WSS4JOutInterceptorInternal.handleMessage(WSS4JOutInterceptor.java:134)[116:org.apache.cxf.bundle:2.3.2]
	at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:255)[116:org.apache.cxf.bundle:2.3.2]
	at
org.apache.servicemix.cxfbc.CxfBcProvider.process(CxfBcProvider.java:247)[156:servicemix-cxf-bc:2011.01.0]
	at
org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:651)[121:servicemix-common:2011.01.0]
	at
org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:606)[121:servicemix-common:2011.01.0]
	at
org.apache.servicemix.common.AsyncBaseLifeCycle.processExchangeInTx(AsyncBaseLifeCycle.java:501)[121:servicemix-common:2011.01.0]
	at
org.apache.servicemix.common.AsyncBaseLifeCycle$2.run(AsyncBaseLifeCycle.java:370)[121:servicemix-common:2011.01.0]
	at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)[:1.6.0_24]
	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)[:1.6.0_24]
	at java.lang.Thread.run(Thread.java:662)[:1.6.0_24]
18:57:27,953 | DEBUG | rovider-thread-4 | PhaseInterceptorChain            | 
-  -  | Invoking handleFault on interceptor
org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor$WSS4JOutInterceptorInternal@1073812
18:57:27,953 | DEBUG | rovider-thread-4 | PhaseInterceptorChain            | 
-  -  | Invoking handleFault on interceptor
org.apache.servicemix.cxfbc.interceptors.JbiOutWsdl1Interceptor@141daa9
18:57:27,953 | DEBUG | rovider-thread-4 | PhaseInterceptorChain            | 
-  -  | Invoking handleFault on interceptor
org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor@19a8bd1
18:57:27,953 | DEBUG | rovider-thread-4 | PhaseInterceptorChain            | 
-  -  | Invoking handleFault on interceptor
org.apache.cxf.ws.addressing.soap.MAPCodec@e0907c
18:57:27,953 | DEBUG | rovider-thread-4 | ContextUtils                     | 
-  -  | retrieving MAPs from context property {0}
18:57:27,953 | DEBUG | rovider-thread-4 | ContextUtils                     | 
-  -  | current MAPs {0}
18:57:27,953 | DEBUG | rovider-thread-4 | PhaseInterceptorChain            | 
-  -  | Invoking handleFault on interceptor
org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor@16e2c09
18:57:27,953 | DEBUG | rovider-thread-4 | PhaseInterceptorChain            | 
-  -  | Invoking handleFault on interceptor
org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor@f0e58b
18:57:27,953 | DEBUG | rovider-thread-4 | PhaseInterceptorChain            | 
-  -  | Invoking handleFault on interceptor org.apache.cxf.intercep
tor.StaxOutInterceptor@151516b

Here enclosed config files for your reference. The same exception i observed
when working with CXF alone.
Regards,
Praveen Chakinala http://cxf.547215.n5.nabble.com/file/n4338295/config.zip
config.zip 

--
View this message in context: http://cxf.547215.n5.nabble.com/java-lang-ClassCastException-com-sun-org-apache-xerces-internal-dom-DocumentImpl-cannot-be-cast-to-ct-tp4338295p4338295.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: java.lang.ClassCastException: com.sun.org.apache.xerces.internal.dom.DocumentImpl cannot be cast to com.sun.xml.messaging.saaj.soap.SOAPDocument

Posted by Freeman Fang <fr...@gmail.com>.
On 2011-4-25, at 下午9:55, pchakinala wrote:

> Hi,
> I am working with Apache servicemix 4.3 to expose/call webservices.It
> internally using CXF 2.3.2 and Open saml 1.1 to implement security.
> My usecase flow is like below.
>  http client ----> cxfbc provider --->call webservice
>
>  CXF Configuration:
> ---------------------
>
> <cxfbc:provider wsdl="classpath:service.wsdl"
>        locationURI="http://localhost:2000/orderapp/OrderProcess"
>                  service="tns:OrderProcessImplService"
>        endpoint="OrderProcessPort"
>                useJBIWrapper="false"
>                useSOAPEnvelope="false">
>       <cxfbc:outInterceptors>
>
>       <bean id="logout"
> class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
>          <bean id="saajout"
> class="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor"/>
>          <bean id="wss4jout"
> class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
>              <constructor-arg>
>                  <map>
>                                        <entry key="action"  
> value="Signature
> SAMLTokenSigned"/>
>                                                <entry key="user"
> value="myAlias" />
>                                                          <entry
> key="passwordType" value="PasswordText"/>
>                                        <entry key="samlPropFile"
> value="client_saml.properties"/>
>                                         <entry key="signaturePropFile"
> value="hub_client_sign.properties"/>
>                                        <entry>
>                                                 <key>
>
> <value>passwordCallbackRef</value>
>                                                </key>
>                                                <ref
> bean="passwordCallback"/>
>                                                </entry>
>                                                <entry
> key="enableNamespacePrefixOptimization" value="true"/>
>                                                <entry
> key="disablePrettyXML" value="true"/>
>                                                <entry  
> key="sendXsiTypes"
> value="true"/>
>                                                <entry  
> key="sendMultiRefs"
> value="true"/>
>                                                <entry
> key="sendXMLDeclaration" value="true"/>
>                 </map>
>              </constructor-arg>
>          </bean>
>
> </cxfbc:outInterceptors>
> </cxfbc:provider>
>
> I found below exception in the servicemix log file.
>
> Checkpoint done.
> 18:57:25,578 | DEBUG | nitor WriteCheck |  
> InactivityMonitor                |
> 43 - org.apache.activemq.activemq-core - 5.4.2 | 10000 ms elapsed  
> since last
> write check.
> 18:57:25,578 | DEBUG | nitor WriteCheck |  
> InactivityMonitor                |
> 43 - org.apache.activemq.activemq-core - 5.4.2 | 10000 ms elapsed  
> since last
> write check.
> 18:57:26,343 | DEBUG | nitor WriteCheck |  
> InactivityMonitor                |
> 43 - org.apache.activemq.activemq-core - 5.4.2 | 10000 ms elapsed  
> since last
> write check.
> 18:57:26,343 | DEBUG | nitor WriteCheck |  
> InactivityMonitor                |
> 43 - org.apache.activemq.activemq-core - 5.4.2 | 10000 ms elapsed  
> since last
> write check.
> 18:57:27,953 | DEBUG | rovider-thread-4 |  
> SAMLIssuerImpl                   |
> 113 - org.apache.ws.security.wss4j - 1.5.9 |
> com.sun.org.apache.xerces.internal.dom.DocumentImpl cannot be cast to
> com.sun.xml.messaging.saaj.soap.SOAPDocument
> java.lang.ClassCastException:
> com.sun.org.apache.xerces.internal.dom.DocumentImpl cannot be cast to
> com.sun.xml.messaging.saaj.soap.SOAPDocument
> 	at
> com 
> .sun 
> .xml 
> .messaging 
> .saaj.soap.impl.ElementImpl.getOwnerDocument(ElementImpl.java:147) 
> [111:org.apache.servicemix.bundles.saaj-impl:1.3.2.2]
> 	at
> com 
> .sun 
> .org 
> .apache 
> .xerces.internal.dom.ParentNode.internalInsertBefore(ParentNode.java: 
> 389)[:]
> 	at
> com 
> .sun 
> .org 
> .apache.xerces.internal.dom.ParentNode.insertBefore(ParentNode.java: 
> 322)[:]
> 	at
> com 
> .sun 
> .org.apache.xerces.internal.dom.NodeImpl.appendChild(NodeImpl.java: 
> 273)[:]
> 	at org.opensaml.SAMLSubject.toDOM(Unknown
> Source)[114:org.apache.servicemix.bundles.opensaml:1.1.0.5]
> 	at org.opensaml.SAMLSubjectStatement.toDOM(Unknown
> Source)[114:org.apache.servicemix.bundles.opensaml:1.1.0.5]
> 	at org.opensaml.SAMLAuthenticationStatement.toDOM(Unknown
> Source)[114:org.apache.servicemix.bundles.opensaml:1.1.0.5]
> 	at org.opensaml.SAMLAssertion.toDOM(Unknown
> Source)[114:org.apache.servicemix.bundles.opensaml:1.1.0.5]
> 	at org.opensaml.SAMLObject.toDOM(Unknown
> Source)[114:org.apache.servicemix.bundles.opensaml:1.1.0.5]
> 	at org.opensaml.SAMLSignedObject.toDOM(Unknown
> Source)[114:org.apache.servicemix.bundles.opensaml:1.1.0.5]
> 	at org.opensaml.SAMLObject.toDOM(Unknown
> Source)[114:org.apache.servicemix.bundles.opensaml:1.1.0.5]
> 	at org.opensaml.SAMLSignedObject.sign(Unknown
> Source)[114:org.apache.servicemix.bundles.opensaml:1.1.0.5]
> 	at org.opensaml.SAMLSignedObject.sign(Unknown
> Source)[114:org.apache.servicemix.bundles.opensaml:1.1.0.5]
> 	at
> org 
> .apache 
> .ws.security.saml.SAMLIssuerImpl.newAssertion(SAMLIssuerImpl.java: 
> 237)[113:org.apache.ws.security.wss4j:1.5.9]
> 	at
> org 
> .apache 
> .ws 
> .security 
> .action.SAMLTokenSignedAction.execute(SAMLTokenSignedAction.java:61) 
> [113:org.apache.ws.security.wss4j:1.5.9]
> 	at
> org 
> .apache.ws.security.handler.WSHandler.doSenderAction(WSHandler.java: 
> 205)[113:org.apache.ws.security.wss4j:1.5.9]
> 	at
> org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor.access 
> $200(WSS4JOutInterceptor.java:50)[116:org.apache.cxf.bundle:2.3.2]
> 	at
> org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor 
> $WSS4JOutInterceptorInternal.handleMessage(WSS4JOutInterceptor.java: 
> 257)[116:org.apache.cxf.bundle:2.3.2]
> 	at
> org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor 
> $WSS4JOutInterceptorInternal.handleMessage(WSS4JOutInterceptor.java: 
> 134)[116:org.apache.cxf.bundle:2.3.2]
> 	at
> org 
> .apache 
> .cxf 
> .phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java: 
> 255)[116:org.apache.cxf.bundle:2.3.2]
> 	at
> org.apache.servicemix.cxfbc.CxfBcProvider.process(CxfBcProvider.java: 
> 247)[156:servicemix-cxf-bc:2011.01.0]
> 	at
> org 
> .apache 
> .servicemix 
> .common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:651) 
> [121:servicemix-common:2011.01.0]
> 	at
> org 
> .apache 
> .servicemix 
> .common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java: 
> 606)[121:servicemix-common:2011.01.0]
> 	at
> org 
> .apache 
> .servicemix 
> .common 
> .AsyncBaseLifeCycle.processExchangeInTx(AsyncBaseLifeCycle.java:501) 
> [121:servicemix-common:2011.01.0]
> 	at
> org.apache.servicemix.common.AsyncBaseLifeCycle 
> $2.run(AsyncBaseLifeCycle.java:370)[121:servicemix-common:2011.01.0]
> 	at
> java.util.concurrent.ThreadPoolExecutor 
> $Worker.runTask(ThreadPoolExecutor.java:886)[:1.6.0_24]
> 	at
> java.util.concurrent.ThreadPoolExecutor 
> $Worker.run(ThreadPoolExecutor.java:908)[:1.6.0_24]
> 	at java.lang.Thread.run(Thread.java:662)[:1.6.0_24]
> 18:57:27,953 | DEBUG | rovider-thread-4 |  
> PhaseInterceptorChain            |
> -  -  | Invoking handleFault on interceptor
> org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor 
> $WSS4JOutInterceptorInternal@1073812
> 18:57:27,953 | DEBUG | rovider-thread-4 |  
> PhaseInterceptorChain            |
> -  -  | Invoking handleFault on interceptor
> org 
> .apache.servicemix.cxfbc.interceptors.JbiOutWsdl1Interceptor@141daa9
> 18:57:27,953 | DEBUG | rovider-thread-4 |  
> PhaseInterceptorChain            |
> -  -  | Invoking handleFault on interceptor
> org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor@19a8bd1
> 18:57:27,953 | DEBUG | rovider-thread-4 |  
> PhaseInterceptorChain            |
> -  -  | Invoking handleFault on interceptor
> org.apache.cxf.ws.addressing.soap.MAPCodec@e0907c
> 18:57:27,953 | DEBUG | rovider-thread-4 |  
> ContextUtils                     |
> -  -  | retrieving MAPs from context property {0}
> 18:57:27,953 | DEBUG | rovider-thread-4 |  
> ContextUtils                     |
> -  -  | current MAPs {0}
> 18:57:27,953 | DEBUG | rovider-thread-4 |  
> PhaseInterceptorChain            |
> -  -  | Invoking handleFault on interceptor
> org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor@16e2c09
> 18:57:27,953 | DEBUG | rovider-thread-4 |  
> PhaseInterceptorChain            |
> -  -  | Invoking handleFault on interceptor
> org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor@f0e58b
> 18:57:27,953 | DEBUG | rovider-thread-4 |  
> PhaseInterceptorChain            |
> -  -  | Invoking handleFault on interceptor org.apache.cxf.intercep
> tor.StaxOutInterceptor@151516b
>
> Here enclosed config files for your reference. The same exception i  
> observed
> when working with CXF alone.

Hi,

You said "The same exception i observed
when working with CXF alone", Do you mean you also see this problem  
with standalone cxf? If so, could you append a testcase with  
standalone cxf, no servicemix-cxf component get involved, that would  
be simpler for investigating this issue.

Freeman
> Regards,
> Praveen Chakinala http://cxf.547215.n5.nabble.com/file/n4338295/config.zip
> config.zip
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/java-lang-ClassCastException-com-sun-org-apache-xerces-internal-dom-DocumentImpl-cannot-be-cast-to-ct-tp4338295p4338295.html
> Sent from the cxf-user mailing list archive at Nabble.com.

---------------------------------------------
Freeman Fang

FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
Connect at CamelOne May 24-26
The Open Source Integration Conference