Thanks for providing a test, yeah, I'm not really sure at all why InvocationHandler interface submitted to Proxy is lost when checking a given Proxy instance, bizarre. As I said I did try it locally and a cast to InvocationHandler from Proxy was OK...
Either way, I added one extra check against Proxy, it fixed it

Thanks for stressing the client runtime
Sergey



On 20/01/15 14:14, Veit Guna wrote:
Fair enough :)!

I sent you the test case to your email address.

Thanks!
Veit

Am 20. Januar 2015 14:38:15 MEZ, schrieb Sergey Beryozkin 
<[email protected]>:
The following is used to create a proxy:

Class<?>[] ifaces = new Class[]{Client.class,
InvocationHandlerAware.class, cri.getServiceClass()};

you are seeing a cast exception where a Client instance is casted to
InvocationHandlerAware which is a bit strange, may be I can add another

branch there and cast Client to AbstractClient, but I'd like to have a
test case...

Sergey
On 20/01/15 13:29, Sergey Beryozkin wrote:
Hi

It works for me.
Can you please set up a simple test project ?

Thanks, Sergey
On 20/01/15 11:10, Veit Guna wrote:
Hi.

I'm using CXF 3.0.3 together with the CXF client proxy API.
For that, I'm using the interfaces (!) from the server side
implementation on the client.

I tried to convert the proxy into a WebClient like explained here:


http://cxf.apache.org/docs/jax-rs-client-api.html#JAX-RSClientAPI-ConvertingproxiestoWebClientsandviceversa


But that ends in:

Exception in thread "main" java.lang.ClassCastException:
com.sun.proxy.$Proxy37 cannot be cast to
org.apache.cxf.jaxrs.client.InvocationHandlerAware
                  at

org.apache.cxf.jaxrs.client.WebClient.toAbstractClient(WebClient.java:1235)

                  at

org.apache.cxf.jaxrs.client.WebClient.copyProperties(WebClient.java:1227)
                  at
org.apache.cxf.jaxrs.client.WebClient.fromClient(WebClient.java:273)
                  at
org.apache.cxf.jaxrs.client.WebClient.fromClient(WebClient.java:251)

My code:

MyServiceInterface myServiceInterface =
JAXRSClientFactory.create("http://somewhere";),
MyServiceInterface.class,
providers, username, password, null);
Client client = WebClient.client(myServiceInterface);
WebClient httpClient = WebClient.fromClient(client); // this fails

Any idea where this comes from? Does this part rely on cglib?

Thanks.

Veit




--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com



--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Reply via email to