users@jsonp.java.net

Re: MessageBodyWriter Not Found For JSONP Library

From: Nick <napperley_at_gmail.com>
Date: Fri, 1 Nov 2013 11:16:07 +1300

Receiving the same output after including the missing JAR (jsonp-jaxrs-1.0).
Even did a clean and build before running the client with the added JAR.


On 1 November 2013 10:56, Jitendra Kotamraju
<jitendra.kotamraju_at_oracle.com>wrote:

> On 10/31/13 2:22 PM, Nick wrote:
>
> 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?
>
> You need jsonp-jaxrs.jar. It can be downloaded at
>
> http://search.maven.org/#artifactdetails%7Corg.glassfish%7Cjsonp-jaxrs%7C1.0%7Cbundle
>
> API Javadocs are at :
>
> http://search.maven.org/#artifactdetails%7Cjavax.json%7Cjavax.json-api%7C1.0%7Cbundle
>
> Jitu
>
>