Hi, I am trying to upgrade from CXF 2.7.5 to 3.0.1 but ran into an issue at runtime with the exception mapping. Our mappers are something like this: (I've created the fictious class"SomeError" for this example)
public abstract class AbstractExceptionMapper<E extends Throwable> implements ExceptionMapper<E> { @Override public final Response toResponse(final E exception) { final SomeError error = getSomeError(exception); final ResponseBuilder bldr = Response.status(error.getStatusCode()); bldr.entity(error).type(support.getErrorMediaType()); return bldr.build(); } protected abstract SomeError getSomeError(E exception); } public class JsonProcessingExceptionToSomeErrorMapper extends AbstractExceptionMapper<JsonProcessingException> { @Override protected SomeError getSomeError(final JsonProcessingException exception) { return ExceptionToSomeError.toSomeError(exception); } } The class ExceptionToSomeError performs all of the real mapping depending on the real exception being thrown. There are several exception mapper classes all being injected into the jaxrs:provider in the spring config that all extend the base class AbstractExceptionMapper. This worked fine in CXF 2.7.5. However, in 3.0.1, it appears the code does not deal well with the class implementing the ExceptionMapper being a base class. When it attempts to find the correct mapper class based on the exception, mapper list is not sorted correctly and thus the first class in the list is always picked which results in a ClassCastException being thrown for all exception type except the first one in the list. I'm looking for a little guidance here as to how to approach this issue. Is this a bug in CXF 3.0? thanks. -- View this message in context: http://cxf.547215.n5.nabble.com/3-0-exception-mapping-issue-if-creating-base-exception-mapper-class-tp5747255.html Sent from the cxf-user mailing list archive at Nabble.com.