users@jsonp.java.net

MessageBodyWriter Not Found For JSONP Library

From: Nick <napperley_at_gmail.com>
Date: Fri, 1 Nov 2013 10:22:00 +1300

Have written a small REST client using Jersey and JSONP libraries. After
running the client the following appears in the output window:


====================================================
run:
Exception in thread "main" org.glassfish.jersey.message.internal.
MessageBodyProviderNotFoundException: MessageBodyWriter not found for media
type=application/json, type=class org.glassfish.json.JsonObjectBuilderImpl$
JsonObjectImpl, genericType=class org.glassfish.json.JsonObjectBuilderImpl$
JsonObjectImpl.
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$
TerminalWriterInterceptor.aroundWriteTo(WriterInterceptorExecutor.java:227)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(
WriterInterceptorExecutor.java:149)
at org.glassfish.jersey.message.internal.MessageBodyFactory.writeTo(
MessageBodyFactory.java:1139)
at org.glassfish.jersey.client.ClientRequest.writeEntity(ClientRequest
.java:433)
at org.glassfish.jersey.client.HttpUrlConnector._apply(HttpUrlConnector
.java:310)
at org.glassfish.jersey.client.HttpUrlConnector.apply(HttpUrlConnector
.java:216)
at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:217)
at org.glassfish.jersey.client.JerseyInvocation$2.call(JerseyInvocation
.java:671)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.process(Errors.java:228)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(
RequestScope.java:422)
at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation
.java:667)
at org.glassfish.jersey.client.JerseyInvocation$Builder.method(
JerseyInvocation.java:423)
at org.glassfish.jersey.client.JerseyInvocation$Builder.post(
JerseyInvocation.java:326)
at org.nick.resttester.RestTester.sendPostRequest(RestTester.java:62)
at org.nick.resttester.RestTester.main(RestTester.java:87)
Java Result: 1
BUILD SUCCESSFUL (total time: 1 second)
====================================================


Below is the method that is causing the runtime error:

====================================================
public String sendPostRequest() {
        JsonObject json = Json.createObjectBuilder().
                add("name", "sw-dev").
                build();
        String response = target.
                path("resource").
                path("account").
                path("group").
                request(MediaType.APPLICATION_JSON).
                post(Entity.json(json), String.class);

        return response;
    }
====================================================

Is there a JAR missing that provides a MessageBodyWriter implementation? If
there is where can I download it? Also is there a single JAR/Zip that
contains the Java Docs for JSONP?