cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahazelton <>
Subject ExceptionMapper causing subsequent ClassCastExceptions
Date Thu, 10 Feb 2011 19:50:16 GMT

I have a service method like this:
  public Long createModel(Model model)

I registered an exception mapper like this:
public class CustomWebApplicationExceptionMapper extends
AbstractRestExceptionMapper implements
ExceptionMapper<WebApplicationException> {
  public Response toResponse(WebApplicationException exception)
       Response response =
      return response;

And registered the mapper as a jaxrs:provider:
      <ref bean="CustomWebApplicationExceptionMapper"/>

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

View this message in context:
Sent from the cxf-issues mailing list archive at

View raw message