add it in openejb-jar.xml in cxf.jaxrs.providers property as any provider or use auto provider detection (openejb.jaxrs.providers.auto=true in conf/system.properties) but i wouldn't recommand it since you can get conflicts on commons ones (json/xml body writer typically) Romain Manni-Bucau Twitter: @rmannibucau Blog: http://rmannibucau.wordpress.com/ LinkedIn: http://fr.linkedin.com/in/rmannibucau Github: https://github.com/rmannibucau
2014-04-05 2:17 GMT+02:00 fulltruth <[email protected]>: > Does TomEE 1.6.0 support the use of ExceptionMapper providers? If so, how to > get it to discover the provider? > > It does not seem to be detecting or using my example class below. Throwing > an exception inside of a resource request method simply results in the > default exception page being shown. > > Here is my ExceptionMapper class: > > package com.que.util; > > import javax.ws.rs.core.MediaType; > import javax.ws.rs.core.Response; > import javax.ws.rs.ext.ExceptionMapper; > import javax.ws.rs.ext.Provider; > > import com.que.exception.MissingParameterException; > > @Provider > public class DefaultExceptionHandler implements > ExceptionMapper<MissingParameterException> { > > @Override > public Response toResponse(MissingParameterException e) { > String response = "Mapped by ExceptionMapper: " + > e.getMessage(); > return > Response.serverError().entity(response).type(MediaType.APPLICATION_JSON).build(); > } > } > > > And here is the method throwing the exception: > > @POST > @Path("{id: [0-9]+}") > public Response update(@PathParam("id") Integer userID, User userBean) > throws ClassNotFoundException, MissingParameterException, > SQLException > { > if (userID == null) { > throw new MissingParameterException("id"); > } > > > > -- > View this message in context: > http://openejb.979440.n4.nabble.com/ExceptionMapper-support-in-TomEE-1-6-0-tp4668599.html > Sent from the OpenEJB User mailing list archive at Nabble.com.
