You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by yuplushu <yu...@yahoo.com> on 2012/03/09 17:49:54 UTC
cxf 2.2.5 ws client in websphere v6.1, got ClassCastException error
CXF 2.2.5 client call web service operation from ear that deployed to
webphere application server v6.1. It works fine untill a SOAP header is
added as:
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document d = db.newDocument();
Element dummy = d.createElement("dummy");
dummy.setTextContent("Dummy Header");
Header dummyHeader = new Header(new QName("urn:dummySpace", "dummyHeader"),
dummy);
List<Header> headersList = new ArrayList<Header>();
headersList.add(dummyHeader);
bindingProvider.getRequestContext().put(Header.HEADER_LIST, headersList);
Then get error:
PhaseIntercep W org.apache.cxf.phase.PhaseInterceptorChain doIntercept
Interceptor has thrown exception, unwinding now
java.lang.ClassCastException:
org.apache.cxf.headers.Header incompatible with
org.apache.cxf.headers.Header
at
org.apache.cxf.binding.soap.interceptor.SoapHeaderOutFilterInterceptor.handleMessage(SoapHeaderOutFilterInterceptor.java:40)
at
org.apache.cxf.binding.soap.interceptor.SoapHeaderOutFilterInterceptor.handleMessage(SoapHeaderOutFilterInterceptor.java:29)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:483)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:309)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:261)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
at $Proxy290.createProgram100(Unknown Source)
I can't find any other cxf jars except cxf-2.2.5.jar.
Also can't change class loader to "PARENT_LAST" because the app
infrastructure requires "PAREAN_FIRST".
Any suggstion to work around it?
--
View this message in context: http://cxf.547215.n5.nabble.com/cxf-2-2-5-ws-client-in-websphere-v6-1-got-ClassCastException-error-tp5551164p5551164.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: cxf 2.2.5 ws client in websphere v6.1, got ClassCastException error
Posted by Mark Streit <mc...@gmail.com>.
This is likely another example of WAS classloader hell...we have been there
too many times in our company. If that application client is packed in a
JAR that is inside your WAR .... Check that you have classloader policy set
to PARENT_LAST and classloader PER Application....NOT single classloader.
The built-in stack that IBM WAS has (included as part of WAS7, but
installed as part of some "Feature Pack" for WAS 6, contains plenty of
JARs w/ conflicting API level classes).
Mark
On Mar 9, 2012 4:03 PM, "yuplushu" <yu...@yahoo.com> wrote:
> Glen,
>
> Thanks for quick response. I tried a couple of ways to add
> SOAPHeader, including SOAPHandler, all worked fine in stand alone. The
> problem is once the jars in Wephere 6.1 are included, variety of errors are
> thrown. I can't get rid of those jars.
> For using SOAPHandler, the error is :
>
> Mar 9, 2012 2:25:59 PM org.apache.cxf.phase.PhaseInterceptorChain
> doIntercept
> WARNING: Interceptor has thrown exception, unwinding now
> org.w3c.dom.DOMException: HIERARCHY_REQUEST_ERR: An attempt was made to
> insert a node where it is not permitted.
> at org.apache.xerces.dom.CoreDocumentImpl.insertBefore(Unknown Source)
> at org.apache.xerces.dom.NodeImpl.appendChild(Unknown Source)
> at
> com.ibm.ws.webservices.engine.xmlsoap.SOAPPart.appendChild(SOAPPart.java:282)
> at
> org.apache.cxf.staxutils.W3CDOMStreamWriter.setChild(W3CDOMStreamWriter.java:114)
> at
> org.apache.cxf.staxutils.W3CDOMStreamWriter.newChild(W3CDOMStreamWriter.java:104)
> at
> org.apache.cxf.staxutils.W3CDOMStreamWriter.writeStartElement(W3CDOMStreamWriter.java:132)
> at
> org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.writeSoapEnvelopeStart(SoapOutInterceptor.java:121)
> at
> org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.handleMessage(SoapOutInterceptor.java:80)
> at
> org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.handleMessage(SoapOutInterceptor.java:61)
> at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:483)
> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:309)
> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:261)
> at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
> at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
> at $Proxy38.createProgram100(Unknown Source)
> at client.glen.mazzas.WSClient.main(WSClient.java:83)
> javax.xml.ws.soap.SOAPFaultException: HIERARCHY_REQUEST_ERR: An attempt
> was made to insert a node where it is not permitted.
> at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:146)
> at $Proxy38.createProgram100(Unknown Source)
> at client.glen.mazzas.WSClient.main(WSClient.java:83)
>
>
>
>
> --- On Fri, 3/9/12, Glen Mazza (Talend) [via CXF] <
> ml-node+s547215n5551302h78@n5.nabble.com> wrote:
>
>
> From: Glen Mazza (Talend) [via CXF] <
> ml-node+s547215n5551302h78@n5.nabble.com>
> Subject: Re: cxf 2.2.5 ws client in websphere v6.1, got ClassCastException
> error
> To: "yuplushu" <yu...@yahoo.com>
> Date: Friday, March 9, 2012, 11:44 AM
>
>
> Not to say that it doesn't exist, but I haven't seen that way of adding
> SOAP Headers before (it almost looks like a way to add HTTP headers
> instead). Links #43 and #44 here:
> http://www.jroller.com/gmazza/entry/blog_article_index show alternative
> ways of adding SOAP headers using interceptors or JAX-WS Handlers. If
> no one else can fix your code below you may wish to look at those methods.
>
> Regards,
> Glen
>
> On 03/09/2012 11:49 AM, yuplushu wrote:
>
> > CXF 2.2.5 client call web service operation from ear that deployed to
> > webphere application server v6.1. It works fine untill a SOAP header is
> > added as:
> >
> > DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
> > DocumentBuilder db = dbf.newDocumentBuilder();
> > Document d = db.newDocument();
> > Element dummy = d.createElement("dummy");
> > dummy.setTextContent("Dummy Header");
> > Header dummyHeader = new Header(new QName("urn:dummySpace",
> "dummyHeader"),
> > dummy);
> > List<Header> headersList = new ArrayList<Header>();
> > headersList.add(dummyHeader);
> > bindingProvider.getRequestContext().put(Header.HEADER_LIST, headersList);
> >
> > Then get error:
> >
> > PhaseIntercep W org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> > Interceptor has thrown exception, unwinding now
> > java.lang.ClassCastException:
> > org.apache.cxf.headers.Header incompatible with
> > org.apache.cxf.headers.Header
> > at
> >
> org.apache.cxf.binding.soap.interceptor.SoapHeaderOutFilterInterceptor.handleMessage(SoapHeaderOutFilterInterceptor.java:40)
> > at
> >
> org.apache.cxf.binding.soap.interceptor.SoapHeaderOutFilterInterceptor.handleMessage(SoapHeaderOutFilterInterceptor.java:29)
> > at
> >
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
> > at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:483)
> > at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:309)
> > at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:261)
> > at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
> > at
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
> > at $Proxy290.createProgram100(Unknown Source)
> >
> > I can't find any other cxf jars except cxf-2.2.5.jar.
> > Also can't change class loader to "PARENT_LAST" because the app
> > infrastructure requires "PAREAN_FIRST".
> > Any suggstion to work around it?
> >
> > --
> > View this message in context:
> http://cxf.547215.n5.nabble.com/cxf-2-2-5-ws-client-in-websphere-v6-1-got-ClassCastException-error-tp5551164p5551164.html
> > Sent from the cxf-user mailing list archive at Nabble.com.
>
> --
> Glen Mazza
> Talend Community Coders - coders.talend.com
> blog: www.jroller.com/gmazza
>
>
>
>
>
>
>
> If you reply to this email, your message will be added to the discussion
> below:
> http://cxf.547215.n5.nabble.com/cxf-2-2-5-ws-client-in-websphere-v6-1-got-ClassCastException-error-tp5551164p5551302.html
> To unsubscribe from cxf 2.2.5 ws client in websphere v6.1, got
> ClassCastException error, click here.
> NAML
>
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/cxf-2-2-5-ws-client-in-websphere-v6-1-got-ClassCastException-error-tp5551164p5551665.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
Re: cxf 2.2.5 ws client in websphere v6.1, got ClassCastException error
Posted by Daniel Kulp <dk...@apache.org>.
At somepoint tomorrow, it would be great if someone would try with the
2.6.0-SNAPSHOT jars that should be built tonight. (or build cxf's trunk
yourself)
I just committed a bunch of updates that may allow CXF to actually work with
the ancient SAAJ implementation that Websphere includes. I was able to
reproduce the HIERARCHY_REQUEST_ERR by modifying one of our system tests to
force using a hacked saaj impl pulled from the Websphere jars (don't ask)
and managed to work around most of the issues. For simple SAAJ usage, it
might actually work. The areas I know will still be problematic are:
1) SOAP 1.2 support - the SAAJ 1.1 API's WebSphere uses doesn't really allow
creating SOAP 1.2 based SAAJ messages.
2) Signing/encrypting - the new xmlsec libs that we need make use of DOM
level 3 API's which are not on the Websphere SAAJ impl. Thus, that is
likely to not work.
HOWEVER, I did discover something else. If you can set a system property
prior to calling the CXF stuff, you MAY be able to get around the automatic
detection of the IBM implementation. CXF checks two system properties:
org.apache.cxf.binding.soap.messageFactoryClassName
org.apache.cxf.binding.soap.soapFactoryClassName
which are the classnames for the SAAJ MessageFactory and SOAPFactory classes
that you specifically want CXF to use. You might be able to set it to:
com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl
and
com.sun.xml.messaging.saaj.soap.ver1_1.SOAPFactory1_1Impl
to pickup the version in the saaj-impl jar. Not really sure though.
Dan
On Friday, March 09, 2012 12:37:39 PM yuplushu wrote:
> Glen,
>
> Thanks for quick response. I tried a couple of ways to add
> SOAPHeader, including SOAPHandler, all worked fine in stand alone. The
> problem is once the jars in Wephere 6.1 are included, variety of errors
> are thrown. I can't get rid of those jars. For using SOAPHandler, the
> error is :
>
> Mar 9, 2012 2:25:59 PM org.apache.cxf.phase.PhaseInterceptorChain
> doIntercept WARNING: Interceptor has thrown exception, unwinding now
> org.w3c.dom.DOMException: HIERARCHY_REQUEST_ERR: An attempt was made to
> insert a node where it is not permitted. at
> org.apache.xerces.dom.CoreDocumentImpl.insertBefore(Unknown Source) at
> org.apache.xerces.dom.NodeImpl.appendChild(Unknown Source)
> at
> com.ibm.ws.webservices.engine.xmlsoap.SOAPPart.appendChild(SOAPPart.java:
> 282) at
> org.apache.cxf.staxutils.W3CDOMStreamWriter.setChild(W3CDOMStreamWriter.j
> ava:114) at
> org.apache.cxf.staxutils.W3CDOMStreamWriter.newChild(W3CDOMStreamWriter.j
> ava:104) at
> org.apache.cxf.staxutils.W3CDOMStreamWriter.writeStartElement(W3CDOMStrea
> mWriter.java:132) at
> org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.writeSoapEnvel
> opeStart(SoapOutInterceptor.java:121) at
> org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.handleMessage(
> SoapOutInterceptor.java:80) at
> org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.handleMessage(
> SoapOutInterceptor.java:61) at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorCh
> ain.java:236) at
> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:483) at
> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:309) at
> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:261) at
> org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73) at
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
> at $Proxy38.createProgram100(Unknown Source)
> at client.glen.mazzas.WSClient.main(WSClient.java:83)
> javax.xml.ws.soap.SOAPFaultException: HIERARCHY_REQUEST_ERR: An attempt
> was made to insert a node where it is not permitted. at
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:146)
> at $Proxy38.createProgram100(Unknown Source)
> at client.glen.mazzas.WSClient.main(WSClient.java:83)
>
>
>
>
> --- On Fri, 3/9/12, Glen Mazza (Talend) [via CXF]
> <ml...@n5.nabble.com> wrote:
>
>
> From: Glen Mazza (Talend) [via CXF]
> <ml...@n5.nabble.com> Subject: Re: cxf 2.2.5 ws
> client in websphere v6.1, got ClassCastException error To: "yuplushu"
> <yu...@yahoo.com>
> Date: Friday, March 9, 2012, 11:44 AM
>
>
> Not to say that it doesn't exist, but I haven't seen that way of adding
> SOAP Headers before (it almost looks like a way to add HTTP headers
> instead). Links #43 and #44 here:
> http://www.jroller.com/gmazza/entry/blog_article_index show alternative
> ways of adding SOAP headers using interceptors or JAX-WS Handlers. If
> no one else can fix your code below you may wish to look at those methods.
>
> Regards,
> Glen
>
> On 03/09/2012 11:49 AM, yuplushu wrote:
> > CXF 2.2.5 client call web service operation from ear that deployed to
> > webphere application server v6.1. It works fine untill a SOAP header is
> > added as:
> >
> > DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
> > DocumentBuilder db = dbf.newDocumentBuilder();
> > Document d = db.newDocument();
> > Element dummy = d.createElement("dummy");
> > dummy.setTextContent("Dummy Header");
> > Header dummyHeader = new Header(new QName("urn:dummySpace",
> > "dummyHeader"), dummy);
> > List<Header> headersList = new ArrayList<Header>();
> > headersList.add(dummyHeader);
> > bindingProvider.getRequestContext().put(Header.HEADER_LIST,
> > headersList);
> >
> > Then get error:
> >
> > PhaseIntercep W org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> > Interceptor has thrown exception, unwinding now
> > java.lang.ClassCastException:
> > org.apache.cxf.headers.Header incompatible with
> > org.apache.cxf.headers.Header
> > at
> > org.apache.cxf.binding.soap.interceptor.SoapHeaderOutFilterInterceptor.h
> > andleMessage(SoapHeaderOutFilterInterceptor.java:40) at
> > org.apache.cxf.binding.soap.interceptor.SoapHeaderOutFilterInterceptor.h
> > andleMessage(SoapHeaderOutFilterInterceptor.java:29) at
> > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorC
> > hain.java:236) at
> > org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:483) at
> > org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:309) at
> > org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:261) at
> > org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73) at
> > org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
> > at $Proxy290.createProgram100(Unknown Source)
> >
> > I can't find any other cxf jars except cxf-2.2.5.jar.
> > Also can't change class loader to "PARENT_LAST" because the app
> > infrastructure requires "PAREAN_FIRST".
> > Any suggstion to work around it?
--
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com
Re: cxf 2.2.5 ws client in websphere v6.1, got ClassCastException
error
Posted by Glen Mazza <gm...@talend.com>.
Well, as IBM itself recommends[1], if you're using CXF on Websphere
you're going to need to switch to parent-last classloading. If, as you
say, your managers won't let you do that, I can't offer a solution,
because you're going to have IBM JARs conflicting with what CXF is
expecting that way, and it's not good to run CXF in such an environment
(even if it would appear to work). Maybe someone else on the list can
see something for you.
Sorry,
Glen
[1]
http://www.ibm.com/developerworks/websphere/library/techarticles/1001_thaker/1001_thaker.html
On 03/09/2012 03:37 PM, yuplushu wrote:
> Glen,
>
> Thanks for quick response. I tried a couple of ways to add SOAPHeader, including SOAPHandler, all worked fine in stand alone. The problem is once the jars in Wephere 6.1 are included, variety of errors are thrown. I can't get rid of those jars.
> For using SOAPHandler, the error is :
>
> Mar 9, 2012 2:25:59 PM org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> WARNING: Interceptor has thrown exception, unwinding now
> org.w3c.dom.DOMException: HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it is not permitted.
> at org.apache.xerces.dom.CoreDocumentImpl.insertBefore(Unknown Source)
> at org.apache.xerces.dom.NodeImpl.appendChild(Unknown Source)
> at com.ibm.ws.webservices.engine.xmlsoap.SOAPPart.appendChild(SOAPPart.java:282)
> at org.apache.cxf.staxutils.W3CDOMStreamWriter.setChild(W3CDOMStreamWriter.java:114)
> at org.apache.cxf.staxutils.W3CDOMStreamWriter.newChild(W3CDOMStreamWriter.java:104)
> at org.apache.cxf.staxutils.W3CDOMStreamWriter.writeStartElement(W3CDOMStreamWriter.java:132)
> at org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.writeSoapEnvelopeStart(SoapOutInterceptor.java:121)
> at org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.handleMessage(SoapOutInterceptor.java:80)
> at org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.handleMessage(SoapOutInterceptor.java:61)
> at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:483)
> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:309)
> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:261)
> at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
> at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
> at $Proxy38.createProgram100(Unknown Source)
> at client.glen.mazzas.WSClient.main(WSClient.java:83)
> javax.xml.ws.soap.SOAPFaultException: HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it is not permitted.
> at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:146)
> at $Proxy38.createProgram100(Unknown Source)
> at client.glen.mazzas.WSClient.main(WSClient.java:83)
>
>
>
>
> --- On Fri, 3/9/12, Glen Mazza (Talend) [via CXF]<ml...@n5.nabble.com> wrote:
>
>
> From: Glen Mazza (Talend) [via CXF]<ml...@n5.nabble.com>
> Subject: Re: cxf 2.2.5 ws client in websphere v6.1, got ClassCastException error
> To: "yuplushu"<yu...@yahoo.com>
> Date: Friday, March 9, 2012, 11:44 AM
>
>
> Not to say that it doesn't exist, but I haven't seen that way of adding
> SOAP Headers before (it almost looks like a way to add HTTP headers
> instead). Links #43 and #44 here:
> http://www.jroller.com/gmazza/entry/blog_article_index show alternative
> ways of adding SOAP headers using interceptors or JAX-WS Handlers. If
> no one else can fix your code below you may wish to look at those methods.
>
> Regards,
> Glen
>
> On 03/09/2012 11:49 AM, yuplushu wrote:
>
>> CXF 2.2.5 client call web service operation from ear that deployed to
>> webphere application server v6.1. It works fine untill a SOAP header is
>> added as:
>>
>> DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
>> DocumentBuilder db = dbf.newDocumentBuilder();
>> Document d = db.newDocument();
>> Element dummy = d.createElement("dummy");
>> dummy.setTextContent("Dummy Header");
>> Header dummyHeader = new Header(new QName("urn:dummySpace", "dummyHeader"),
>> dummy);
>> List<Header> headersList = new ArrayList<Header>();
>> headersList.add(dummyHeader);
>> bindingProvider.getRequestContext().put(Header.HEADER_LIST, headersList);
>>
>> Then get error:
>>
>> PhaseIntercep W org.apache.cxf.phase.PhaseInterceptorChain doIntercept
>> Interceptor has thrown exception, unwinding now
>> java.lang.ClassCastException:
>> org.apache.cxf.headers.Header incompatible with
>> org.apache.cxf.headers.Header
>> at
>> org.apache.cxf.binding.soap.interceptor.SoapHeaderOutFilterInterceptor.handleMessage(SoapHeaderOutFilterInterceptor.java:40)
>> at
>> org.apache.cxf.binding.soap.interceptor.SoapHeaderOutFilterInterceptor.handleMessage(SoapHeaderOutFilterInterceptor.java:29)
>> at
>> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
>> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:483)
>> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:309)
>> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:261)
>> at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
>> at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
>> at $Proxy290.createProgram100(Unknown Source)
>>
>> I can't find any other cxf jars except cxf-2.2.5.jar.
>> Also can't change class loader to "PARENT_LAST" because the app
>> infrastructure requires "PAREAN_FIRST".
>> Any suggstion to work around it?
>>
>> --
>> View this message in context: http://cxf.547215.n5.nabble.com/cxf-2-2-5-ws-client-in-websphere-v6-1-got-ClassCastException-error-tp5551164p5551164.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
--
Glen Mazza
Talend Community Coders - coders.talend.com
blog: www.jroller.com/gmazza
Re: cxf 2.2.5 ws client in websphere v6.1, got ClassCastException
error
Posted by yuplushu <yu...@yahoo.com>.
Glen,
Thanks for quick response. I tried a couple of ways to add SOAPHeader, including SOAPHandler, all worked fine in stand alone. The problem is once the jars in Wephere 6.1 are included, variety of errors are thrown. I can't get rid of those jars.
For using SOAPHandler, the error is :
Mar 9, 2012 2:25:59 PM org.apache.cxf.phase.PhaseInterceptorChain doIntercept
WARNING: Interceptor has thrown exception, unwinding now
org.w3c.dom.DOMException: HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it is not permitted.
at org.apache.xerces.dom.CoreDocumentImpl.insertBefore(Unknown Source)
at org.apache.xerces.dom.NodeImpl.appendChild(Unknown Source)
at com.ibm.ws.webservices.engine.xmlsoap.SOAPPart.appendChild(SOAPPart.java:282)
at org.apache.cxf.staxutils.W3CDOMStreamWriter.setChild(W3CDOMStreamWriter.java:114)
at org.apache.cxf.staxutils.W3CDOMStreamWriter.newChild(W3CDOMStreamWriter.java:104)
at org.apache.cxf.staxutils.W3CDOMStreamWriter.writeStartElement(W3CDOMStreamWriter.java:132)
at org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.writeSoapEnvelopeStart(SoapOutInterceptor.java:121)
at org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.handleMessage(SoapOutInterceptor.java:80)
at org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.handleMessage(SoapOutInterceptor.java:61)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:483)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:309)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:261)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
at $Proxy38.createProgram100(Unknown Source)
at client.glen.mazzas.WSClient.main(WSClient.java:83)
javax.xml.ws.soap.SOAPFaultException: HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it is not permitted.
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:146)
at $Proxy38.createProgram100(Unknown Source)
at client.glen.mazzas.WSClient.main(WSClient.java:83)
--- On Fri, 3/9/12, Glen Mazza (Talend) [via CXF] <ml...@n5.nabble.com> wrote:
From: Glen Mazza (Talend) [via CXF] <ml...@n5.nabble.com>
Subject: Re: cxf 2.2.5 ws client in websphere v6.1, got ClassCastException error
To: "yuplushu" <yu...@yahoo.com>
Date: Friday, March 9, 2012, 11:44 AM
Not to say that it doesn't exist, but I haven't seen that way of adding
SOAP Headers before (it almost looks like a way to add HTTP headers
instead). Links #43 and #44 here:
http://www.jroller.com/gmazza/entry/blog_article_index show alternative
ways of adding SOAP headers using interceptors or JAX-WS Handlers. If
no one else can fix your code below you may wish to look at those methods.
Regards,
Glen
On 03/09/2012 11:49 AM, yuplushu wrote:
> CXF 2.2.5 client call web service operation from ear that deployed to
> webphere application server v6.1. It works fine untill a SOAP header is
> added as:
>
> DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
> DocumentBuilder db = dbf.newDocumentBuilder();
> Document d = db.newDocument();
> Element dummy = d.createElement("dummy");
> dummy.setTextContent("Dummy Header");
> Header dummyHeader = new Header(new QName("urn:dummySpace", "dummyHeader"),
> dummy);
> List<Header> headersList = new ArrayList<Header>();
> headersList.add(dummyHeader);
> bindingProvider.getRequestContext().put(Header.HEADER_LIST, headersList);
>
> Then get error:
>
> PhaseIntercep W org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> Interceptor has thrown exception, unwinding now
> java.lang.ClassCastException:
> org.apache.cxf.headers.Header incompatible with
> org.apache.cxf.headers.Header
> at
> org.apache.cxf.binding.soap.interceptor.SoapHeaderOutFilterInterceptor.handleMessage(SoapHeaderOutFilterInterceptor.java:40)
> at
> org.apache.cxf.binding.soap.interceptor.SoapHeaderOutFilterInterceptor.handleMessage(SoapHeaderOutFilterInterceptor.java:29)
> at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:483)
> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:309)
> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:261)
> at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
> at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
> at $Proxy290.createProgram100(Unknown Source)
>
> I can't find any other cxf jars except cxf-2.2.5.jar.
> Also can't change class loader to "PARENT_LAST" because the app
> infrastructure requires "PAREAN_FIRST".
> Any suggstion to work around it?
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/cxf-2-2-5-ws-client-in-websphere-v6-1-got-ClassCastException-error-tp5551164p5551164.html
> Sent from the cxf-user mailing list archive at Nabble.com.
--
Glen Mazza
Talend Community Coders - coders.talend.com
blog: www.jroller.com/gmazza
If you reply to this email, your message will be added to the discussion below:http://cxf.547215.n5.nabble.com/cxf-2-2-5-ws-client-in-websphere-v6-1-got-ClassCastException-error-tp5551164p5551302.html
To unsubscribe from cxf 2.2.5 ws client in websphere v6.1, got ClassCastException error, click here.
NAML
--
View this message in context: http://cxf.547215.n5.nabble.com/cxf-2-2-5-ws-client-in-websphere-v6-1-got-ClassCastException-error-tp5551164p5551665.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: cxf 2.2.5 ws client in websphere v6.1, got ClassCastException
error
Posted by Glen Mazza <gm...@talend.com>.
Not to say that it doesn't exist, but I haven't seen that way of adding
SOAP Headers before (it almost looks like a way to add HTTP headers
instead). Links #43 and #44 here:
http://www.jroller.com/gmazza/entry/blog_article_index show alternative
ways of adding SOAP headers using interceptors or JAX-WS Handlers. If
no one else can fix your code below you may wish to look at those methods.
Regards,
Glen
On 03/09/2012 11:49 AM, yuplushu wrote:
> CXF 2.2.5 client call web service operation from ear that deployed to
> webphere application server v6.1. It works fine untill a SOAP header is
> added as:
>
> DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
> DocumentBuilder db = dbf.newDocumentBuilder();
> Document d = db.newDocument();
> Element dummy = d.createElement("dummy");
> dummy.setTextContent("Dummy Header");
> Header dummyHeader = new Header(new QName("urn:dummySpace", "dummyHeader"),
> dummy);
> List<Header> headersList = new ArrayList<Header>();
> headersList.add(dummyHeader);
> bindingProvider.getRequestContext().put(Header.HEADER_LIST, headersList);
>
> Then get error:
>
> PhaseIntercep W org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> Interceptor has thrown exception, unwinding now
> java.lang.ClassCastException:
> org.apache.cxf.headers.Header incompatible with
> org.apache.cxf.headers.Header
> at
> org.apache.cxf.binding.soap.interceptor.SoapHeaderOutFilterInterceptor.handleMessage(SoapHeaderOutFilterInterceptor.java:40)
> at
> org.apache.cxf.binding.soap.interceptor.SoapHeaderOutFilterInterceptor.handleMessage(SoapHeaderOutFilterInterceptor.java:29)
> at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:483)
> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:309)
> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:261)
> at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
> at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
> at $Proxy290.createProgram100(Unknown Source)
>
> I can't find any other cxf jars except cxf-2.2.5.jar.
> Also can't change class loader to "PARENT_LAST" because the app
> infrastructure requires "PAREAN_FIRST".
> Any suggstion to work around it?
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/cxf-2-2-5-ws-client-in-websphere-v6-1-got-ClassCastException-error-tp5551164p5551164.html
> Sent from the cxf-user mailing list archive at Nabble.com.
--
Glen Mazza
Talend Community Coders - coders.talend.com
blog: www.jroller.com/gmazza