Hi I believe this issue has been fixed recently, can you try CXF 2.3.2 please ?
Cheers, Sergey On Thu, Feb 10, 2011 at 7:50 PM, ahazelton <ahazel...@axeda.com> wrote: > > I have a service method like this: > @Override > @POST > @Path("/model/create") > public Long createModel(Model model) > { > ... > } > > I registered an exception mapper like this: > public class CustomWebApplicationExceptionMapper extends > AbstractRestExceptionMapper implements > ExceptionMapper<WebApplicationException> { > @Override > public Response toResponse(WebApplicationException exception) > { > Response response = > Response.status(Response.Status.BAD_REQUEST).type(MediaType.APPLICATION_XML).entity(someString).build(); > return response; > } > ... > } > } > > And registered the mapper as a jaxrs:provider: > <jaxrs:providers> > ... > <ref bean="CustomWebApplicationExceptionMapper"/> > </jaxrs:providers> > > I have verified that in the debugger my exception mapper is getting called > and the expected response generated. Unfortunately when this response is > sent back to the client the JAXRSOutInterceptor is triggering a > ClassCastException. It appears to be because the service method returns a > Long and the Response object is a String. I changed the service method > return type above from a Long to a String and the class cast goes away. > > How can I use an ExceptionMapper for any method, regardless of its return > type? > > -- > View this message in context: > http://cxf.547215.n5.nabble.com/ExceptionMapper-causing-subsequent-ClassCastExceptions-tp3379990p3379990.html > Sent from the cxf-issues mailing list archive at Nabble.com. >