Thanks Sam. Right on. I was not registering the providers on the client side. The change below to the client (as in your example), fixed the problem. However, I still need to understand why that needs to be done explicitly. Will continue to dig through the code.
ClientConfig cc = new DefaultClientConfig();
cc.getClasses().add(PropertiesReader.class);
Client c = Client.create(cc);
WebResource resource = c.resource("
http://localhost:8081/ObjectEx/properties");
Properties p = resource.get(Properties.class);
...
From: sam_at_sampullara.com
To: users_at_jersey.dev.java.net
Date: Wed, 31 Dec 2008 19:42:05 -0800
Subject: Re: [Jersey] ClientHandlerException. . . message body reader not found.
Are the Providers getting registered properly? You might want to refer to this blog entry of mine:
http://www.javarants.com/2008/12/27/using-jax-rs-with-protocol-buffers-for-high-performance-rest-apis/
Sam
On Dec 31, 2008, at 7:23 PM, Sudhakar Kumar wrote:I am just getting started with Jersey (1.0.2-SNAPSHOT) . . . Trying out a simpler version of the entity-provider example in the jersey repository. The difference in my case being - read directly from the contents of the Properties Java type instead of a String type as is the case with the example.
The Resource class has one method:
@GET
public Properties getProperties(){
return System.getProperties();
}
I have a PropertiesProvider that implements MessageBodyReader and MessageBodyWriter.
The client:
Client c = Client.create();
WebResource resource = c.resource("
http://localhost:8081/ObjectEx/properties");
Properties p = resource.get(Properties.class);
...
The call gets through to the server but I get the ClientHandlerException on the client with no message body reader for the Properties type.
What am I missing? Can I get some help please?
Thanks
-Sudhakar
It’s the same Hotmail®. If by “same” you mean up to 70% faster. Get your account now.
_________________________________________________________________
It’s the same Hotmail®. If by “same” you mean up to 70% faster.
http://windowslive.com/online/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_broad1_122008