Cheers, Nic
class JacksonJsonProviderWrapper implements MessageBodyReader<Object>,
MessageBodyWriter<Object>, Versioned {
private JacksonJsonProvider jjp = new JacksonJsonProvider();
@Override
public Version version() {
return jjp.version();
}
public void setMapper(ObjectMapper m) {
jjp.setMapper(m);
}
@Override
public boolean isWriteable(Class<?> type, Type genericType,
Annotation[] annotations, MediaType mediaType) {
return jjp.isWriteable(type, genericType, annotations, mediaType);
}
@Override
public long getSize(Object t, Class<?> type, Type genericType,
Annotation[] annotations, MediaType mediaType) {
return jjp.getSize(t, type, genericType, annotations, mediaType);
}
@Override
public void writeTo(Object t, Class<?> type, Type genericType,
Annotation[] annotations, MediaType mediaType,
MultivaluedMap<String, Object> httpHeaders, OutputStream
entityStream) throws IOException,
WebApplicationException {
jjp.writeTo(t, type, genericType, annotations, mediaType,
httpHeaders, entityStream);
}
@Override
public boolean isReadable(Class<?> type, Type genericType,
Annotation[] annotations, MediaType mediaType) {
return jjp.isReadable(type, genericType, annotations, mediaType);
}
@Override
public Object readFrom(Class<Object> type, Type genericType,
Annotation[] annotations,
MediaType mediaType,
MultivaluedMap<String, String> httpHeaders,
InputStream entityStream) throws
IOException, WebApplicationException {
return jjp.readFrom(type, genericType, annotations, mediaType,
httpHeaders, entityStream);
}
}
On 07/06/13 11:34, Sergey Beryozkin wrote:
Hi
On 07/06/13 11:29, Nic Fellows wrote:
I have just upgraded from Jackson 2.1.1 to 2.2.2 and it has caused the
following exception:
javax.ws.rs.client.ClientException: .No message body writer has been
found for class : class uk.co.tbp.gabble.domain.User, ContentType :
application/json.
Has something changed in the way I need to configure the provider?
Known issue, has been fixed for CXF 2.7.6-SNAPSHOT, Jackson 2.2 class
hierarchy has become more complex and that confused the runtime.
Very easy workaround is to wrap Jackson 2.2.x provider in a custom
provider which only delegates to Jackson all of its calls
Cheers, Sergey
Nic