Hi,
I have a very simple jaxrs application, having the resource class containing
a method returning a JSONObject. However on the client side I am trying to
print the returning while calling the get (see below)

Client side:       
        ClientResource cr = new
ClientResource("http://localhost:8182/service";);
        cr.getConverterService().setEnabled(true);
       
        cr.get(MediaType.APPLICATION_JSON).write(System.out);
       
        cr.get(ServiceResourceImpl.class).getServiceDescription();
        String jo =
cr.get(ServiceResourceImpl.class).getServiceDescription();

The last two methods return the following errors:

WARNING: Unable to find a converter for this representation :
[application/json,UTF-8]
Exception in thread "main" java.lang.NullPointerException
    at eu.emi.core.Client.main(Client.java:23)

and

WARNING: Unable to find a converter for this representation :
[application/json,UTF-8]
Exception in thread "main" java.lang.NullPointerException
    at eu.emi.core.Client.main(Client.java:23)

respectively (its the same)!

Strangely the first one with ...write(System.out) works fine. 

On the server side, the resource method is being called without any
problems.

Here is the resource class:

@Path("/service")
public class ServiceResourceImpl{

    /* (non-Javadoc)
     * @see eu.emi.ServiceResource#getServiceDescription(java.lang.String)
     */
    @GET
    @Produces(MediaType.APPLICATION_JSON)
    public JSONObject getServiceDescription() {
        System.out.println("getting service description");
        Map<String, String> map = new HashMap<String, String>();
        map.put("id", "1");
        map.put("name", "data");
       
        return new JSONObject(map);
    }
}

Software version:

* JDK 1.6
* Restlet v 2.0.7 with corresponding jaxrs extension

Could you please help me in resolving this?

Thanks in advance,
Daku

--
View this message in context: 
http://restlet-discuss.1400322.n2.nabble.com/Unable-to-find-a-converter-for-this-representation-application-json-UTF-8-tp6396319p6396319.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2746059

Reply via email to