You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by gsbashal <gu...@statefarm.com> on 2012/08/07 21:56:28 UTC

ClassCastException in BindingProvider casting when using CXF 2.4.2 on WAS 6.1 environment

My Web service Project is running on WAS 6.1 version with using CXF 2.4.2
libraries and it is configured in Maven pom files. This web service project
is working fine through our My tester application ( Dummy Consumer
Application ) and Non mavenized consumer application.  If one of the
consumer application ( which is mavenized ) is adding same jar dependencies
in their pom files and try to launch Credit Card application then it is
hitting with below error at runtime. In below code for JAXWSExecutor class
we are casting webServiceEndpoint object ( which is the instance of
JaxWsClientProxy) to BindingProvider. As per IBM recommendation to handle
this situation we did some settings in Server admin console for the
classloader if we are using third party JAX-WS web services and it is
working fine. But Consumer application want different solution which is
without classloader setting and it should be handled through Maven pom
settings or some other configuration without class loader. Because changing
the class loader policy is not acceptable by the Runtime team at my client. 


IBM Link :
http://pic.dhe.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=%2Fcom.ibm.websphere.base.iseries.doc%2Finfo%2Fiseries%2Fae%2Ftwbs_thirdparty.html


Error :

java.lang.ClassCastException: $Proxy48 incompatible with
javax.xml.ws.BindingProvider
	at
sf.reqfwk.executor.JAXWSExecutor.setHeaderDetails(JAXWSExecutor.java:119)
	at sf.reqfwk.executor.JAXWSExecutor.execute(JAXWSExecutor.java:106)



JAXWSExecutor code where it is hitting with classcast exception

BindingProvider bp = (BindingProvider) webServiceEndpoint;  ( where
BindingProvider is of geronimo-jaxws_2.2_spec-1.0.jar )

So, Could you please suggest what is the solution without changing
classloader policy.



--
View this message in context: http://cxf.547215.n5.nabble.com/ClassCastException-in-BindingProvider-casting-when-using-CXF-2-4-2-on-WAS-6-1-environment-tp5712150.html
Sent from the cxf-issues mailing list archive at Nabble.com.

Re: ClassCastException in BindingProvider casting when using CXF 2.4.2 on WAS 6.1 environment

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

This kind issue generally is from that webServiceEndpoint and BindingProvider are loaded from different class loaders, so it's definitely a class loader issue. I'm not sure if there's a way to completely bypass the class loader configuration in WAS. Where the geronimo-jaxws_2.2_spec-1.0.jar exist? It's in container lib or in your project lib? If both exist I think you can remove one from your project lib.

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

FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: http://weibo.com/u/1473905042

On 2012-8-8, at 上午3:56, gsbashal wrote:

> My Web service Project is running on WAS 6.1 version with using CXF 2.4.2
> libraries and it is configured in Maven pom files. This web service project
> is working fine through our My tester application ( Dummy Consumer
> Application ) and Non mavenized consumer application.  If one of the
> consumer application ( which is mavenized ) is adding same jar dependencies
> in their pom files and try to launch Credit Card application then it is
> hitting with below error at runtime. In below code for JAXWSExecutor class
> we are casting webServiceEndpoint object ( which is the instance of
> JaxWsClientProxy) to BindingProvider. As per IBM recommendation to handle
> this situation we did some settings in Server admin console for the
> classloader if we are using third party JAX-WS web services and it is
> working fine. But Consumer application want different solution which is
> without classloader setting and it should be handled through Maven pom
> settings or some other configuration without class loader. Because changing
> the class loader policy is not acceptable by the Runtime team at my client. 
> 
> 
> IBM Link :
> http://pic.dhe.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=%2Fcom.ibm.websphere.base.iseries.doc%2Finfo%2Fiseries%2Fae%2Ftwbs_thirdparty.html
> 
> 
> Error :
> 
> java.lang.ClassCastException: $Proxy48 incompatible with
> javax.xml.ws.BindingProvider
> 	at
> sf.reqfwk.executor.JAXWSExecutor.setHeaderDetails(JAXWSExecutor.java:119)
> 	at sf.reqfwk.executor.JAXWSExecutor.execute(JAXWSExecutor.java:106)
> 
> 
> 
> JAXWSExecutor code where it is hitting with classcast exception
> 
> BindingProvider bp = (BindingProvider) webServiceEndpoint;  ( where
> BindingProvider is of geronimo-jaxws_2.2_spec-1.0.jar )
> 
> So, Could you please suggest what is the solution without changing
> classloader policy.
> 
> 
> 
> --
> View this message in context: http://cxf.547215.n5.nabble.com/ClassCastException-in-BindingProvider-casting-when-using-CXF-2-4-2-on-WAS-6-1-environment-tp5712150.html
> Sent from the cxf-issues mailing list archive at Nabble.com.