Hi Glen

Nice to see you working on updating the examples, thanks for that.
Please try 2.7.5-SNAPSHOT, this issue should disappear, I updated the client and server runtime to protect itself from multiple RuntimeDelegates floating around, so the foreign JAX-RS Responses are copied to CXF specific instances...

Thanks, Sergey
On 03/05/13 19:01, Glen Mazza wrote:
A similar problem occurs with https-server-glassfish example
(https://github.com/gmazza/jersey-samples-on-cxf/tree/master/https-server-glassfish)
in upgrading from CXF 2.6.7 to CXF 2.7.4 on latest Glassfish Server
3.1.2.2 following instructions given in README:
http://people.apache.org/~gmazza/restexamples/https-server-glassfish;
CXF 2.6.7 works fine but CXF 2.7.4 raises this exception when accessing
https://localhost:8181/httpsBasicAuth-webapp/helloworld after deployment:

java.lang.ClassCastException:
com.sun.jersey.core.spi.factory.ResponseImpl cannot be cast to
org.apache.cxf.jaxrs.impl.ResponseImpl
at
org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.serializeMessage(JAXRSOutInterceptor.java:179)

at
org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.processResponse(JAXRSOutInterceptor.java:148)

at
org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.handleMessage(JAXRSOutInterceptor.java:84)

at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)

at
org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:77)

at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)

at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)

at
org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:239)

at
org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:223)

at
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:203)

at
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:137)

at
org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:158)

at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:243)

at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:168)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:219)



On 05/03/2013 01:17 PM, Glen Mazza wrote:
Hi, I'm in the process of updating my Jersey/CXF samples blog article
(http://www.jroller.com/gmazza/entry/jersey_samples_on_cxf) from CXF
2.6.2 to CXF 2.7.4. 11 of the 15 samples work OOTB with no problem.

One sample, Moxy
(https://github.com/gmazza/jersey-samples-on-cxf/tree/master/moxy,
http://people.apache.org/~gmazza/restexamples/moxy), works fine with
CXF 2.6.2 (actually works as high as CXF 2.6.7) but one of its
integration tests fails with CXF 2.7.4 (fails also with CXF 2.7.0).

Running "mvn clean install" from the moxy folder will activate the
integration test, with 2.7.4 TestCustomer
(https://github.com/gmazza/jersey-samples-on-cxf/blob/master/moxy/src/test/java/com/sun/jersey/samples/moxy/MoxyWebAppTestIT.java#L110)
fails with this error message:

Tests run: 2, Failures: 0, Errors: 1, Skipped: 1, Time elapsed: 2.91
sec <<< FAILURE!
testCustomer(com.sun.jersey.samples.moxy.MoxyWebAppTestIT) Time
elapsed: 1.32 sec <<< ERROR!
javax.ws.rs.client.ClientException: java.lang.ClassCastException:
org.apache.cxf.jaxrs.impl.ResponseImpl cannot be cast to
org.apache.cxf.jaxrs.impl.ResponseImpl
at
org.apache.cxf.jaxrs.client.WebClient.handleResponse(WebClient.java:1086)
at org.apache.cxf.jaxrs.client.WebClient.doResponse(WebClient.java:1049)
at
org.apache.cxf.jaxrs.client.WebClient.doChainedInvocation(WebClient.java:999)

at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:836)
at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:810)
at org.apache.cxf.jaxrs.client.WebClient.invoke(WebClient.java:373)
at org.apache.cxf.jaxrs.client.WebClient.get(WebClient.java:552)
at
com.sun.jersey.samples.moxy.MoxyWebAppTestIT.testCustomer(MoxyWebAppTestIT.java:113)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:601)

Again, if I just change the CXF dependency to 2.6.x in the
moxy/pom.xml, the problem goes away. Anyone know what changed between
2.6.x and 2.7.x for this to occur? Migration notes don't appear to
have much concerning this...

Thanks,
Glen


Reply via email to