You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by dclane <dc...@gmail.com> on 2008/12/08 21:46:27 UTC
ClassCastException with JAX-WS proxies?
I have a client which is trying to retrieve a service object using the
JaxWsProxyFactoryBean. I encounter the following error:
Exception in thread "main" java.lang.ClassCastException: $Proxy54 cannot be
cast to com.company.service.web.ProvisioningService
at com.company.service.web.client.Client.main(Client.java:42)
Here is my service setup:
<jaxws:endpoint id="prov"
implementor="com.company.service.web.ProvisioningService"
address="/provisioning">
<jaxws:inInterceptors>
<ref bean="wssInInterceptor"/>
<ref bean="springInInterceptor"/>
</jaxws:inInterceptors>
</jaxws:endpoint>
And relevant code from my client class:
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
// ...
factory.getInInterceptors().add( new LoggingInInterceptor() );
factory.getOutInterceptors().add( new LoggingOutInterceptor() );
factory.getOutInterceptors().add( wssOut );
factory.setServiceClass( AuthService.class );
factory.setAddress(
"http://localhost:8081/web-services/services/provisioning" );
ProvisioningService client = (ProvisioningService) factory.create();
String something = client.saySomething();
System.out.println( something );
Do I need to set <aop:scoped-proxy/> on my endpoint somewhere/somehow? How
can I access the service object since I'm apparently retrieving a proxy
instead of the actual object?
I've tried turning the <aop:aspectj-autoproxy> proxy-target-class attribute
to false and true, as well as removing the tag altogether. I really just
don't understand how this is supposed to work. Any thoughts?
Thank you!
- Dave
--
View this message in context: http://www.nabble.com/ClassCastException-with-JAX-WS-proxies--tp20903183p20903183.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: ClassCastException with JAX-WS proxies?
Posted by dclane <dc...@gmail.com>.
Wow, that would do it. :) Thank you!
- Dave
dkulp wrote:
>
>
> factory.setServiceClass( AuthService.class );
> .....
> ProvisioningService client = (ProvisioningService)
> factory.create();
>
> You are setting the service class to AuthService.class, but trying to cast
> it
> to a ProvisioningService. One of those lines is most likely wrong.
>
> Dan
>
>
>
> On Monday 08 December 2008 3:46:27 pm dclane wrote:
>> I have a client which is trying to retrieve a service object using the
>> JaxWsProxyFactoryBean. I encounter the following error:
>>
>> Exception in thread "main" java.lang.ClassCastException: $Proxy54 cannot
>> be
>> cast to com.company.service.web.ProvisioningService
>> at com.company.service.web.client.Client.main(Client.java:42)
>>
>> Here is my service setup:
>>
>> <jaxws:endpoint id="prov"
>> implementor="com.company.service.web.ProvisioningService"
>> address="/provisioning">
>> <jaxws:inInterceptors>
>> <ref bean="wssInInterceptor"/>
>> <ref bean="springInInterceptor"/>
>> </jaxws:inInterceptors>
>> </jaxws:endpoint>
>>
>> And relevant code from my client class:
>> JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
>>
>> // ...
>>
>> factory.getInInterceptors().add( new LoggingInInterceptor() );
>> factory.getOutInterceptors().add( new LoggingOutInterceptor() );
>> factory.getOutInterceptors().add( wssOut );
>> factory.setServiceClass( AuthService.class );
>>
>> factory.setAddress(
>> "http://localhost:8081/web-services/services/provisioning" );
>> ProvisioningService client = (ProvisioningService)
>> factory.create(); String something = client.saySomething();
>> System.out.println( something );
>>
>> Do I need to set <aop:scoped-proxy/> on my endpoint somewhere/somehow?
>> How
>> can I access the service object since I'm apparently retrieving a proxy
>> instead of the actual object?
>>
>> I've tried turning the <aop:aspectj-autoproxy> proxy-target-class
>> attribute
>> to false and true, as well as removing the tag altogether. I really just
>> don't understand how this is supposed to work. Any thoughts?
>>
>> Thank you!
>> - Dave
>
>
>
> --
> Daniel Kulp
> dkulp@apache.org
> http://dankulp.com/blog
>
>
--
View this message in context: http://www.nabble.com/ClassCastException-with-JAX-WS-proxies--tp20903183p20904221.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: ClassCastException with JAX-WS proxies?
Posted by Daniel Kulp <dk...@apache.org>.
factory.setServiceClass( AuthService.class );
.....
ProvisioningService client = (ProvisioningService) factory.create();
You are setting the service class to AuthService.class, but trying to cast it
to a ProvisioningService. One of those lines is most likely wrong.
Dan
On Monday 08 December 2008 3:46:27 pm dclane wrote:
> I have a client which is trying to retrieve a service object using the
> JaxWsProxyFactoryBean. I encounter the following error:
>
> Exception in thread "main" java.lang.ClassCastException: $Proxy54 cannot be
> cast to com.company.service.web.ProvisioningService
> at com.company.service.web.client.Client.main(Client.java:42)
>
> Here is my service setup:
>
> <jaxws:endpoint id="prov"
> implementor="com.company.service.web.ProvisioningService"
> address="/provisioning">
> <jaxws:inInterceptors>
> <ref bean="wssInInterceptor"/>
> <ref bean="springInInterceptor"/>
> </jaxws:inInterceptors>
> </jaxws:endpoint>
>
> And relevant code from my client class:
> JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
>
> // ...
>
> factory.getInInterceptors().add( new LoggingInInterceptor() );
> factory.getOutInterceptors().add( new LoggingOutInterceptor() );
> factory.getOutInterceptors().add( wssOut );
> factory.setServiceClass( AuthService.class );
>
> factory.setAddress(
> "http://localhost:8081/web-services/services/provisioning" );
> ProvisioningService client = (ProvisioningService)
> factory.create(); String something = client.saySomething();
> System.out.println( something );
>
> Do I need to set <aop:scoped-proxy/> on my endpoint somewhere/somehow? How
> can I access the service object since I'm apparently retrieving a proxy
> instead of the actual object?
>
> I've tried turning the <aop:aspectj-autoproxy> proxy-target-class attribute
> to false and true, as well as removing the tag altogether. I really just
> don't understand how this is supposed to work. Any thoughts?
>
> Thank you!
> - Dave
--
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog