On 07/06/13 14:33, Nic Fellows wrote:
Thanks Sergey
I tried 2.7.6-SNAPSHOT with no luck, same error.
See
https://issues.apache.org/jira/browse/CXF-4996?page=com.atlassian.jirafisheyeplugin:fisheye-issuepanel
Can you do 'mvn clean' and double check you have 2.7.6-SNAPSHOT loaded ?
So I then tried to fix this by wrapping the provider, but still get the
same problem. I'm not 100% sure on the implementation, would you mind
taking a look at it below and let me know if i'm missing anything?
Do you really need to implement Versioned ? Other than that it looks OK
to me, also add @Produces("application/json") &
@Consumes("application/json"), though it probably should work even
without it
Sergey
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
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Blog: http://sberyozkin.blogspot.com