users@jersey.java.net

[Jersey] Re: Jersey Client JSONRootElementProvider

From: Ronak Patel <ronak2121_at_yahoo.com>
Date: Sun, 6 Nov 2011 08:46:32 -0800 (PST)

Just a note that the ClientConfig Javadoc describes this:

http://jersey.java.net/nonav/apidocs/1.8/jersey/com/sun/jersey/api/client/config/ClientConfig.html

com.sun.jersey.impl.provider.entity.JSONRootElementProvider.class this class doesn't seem to exist inside the jersey-bundle jar file.
Neither does this method seem to work as described below...
Any ideas?


________________________________
From: Ronak Patel <ronak2121_at_yahoo.com>
To: "users_at_jersey.java.net" <users_at_jersey.java.net>
Sent: Sunday, November 6, 2011 11:21 AM
Subject: [Jersey] Jersey Client JSONRootElementProvider


Hello all,

I've recently upgraded to Jersey 1.8 from 1.5 and am getting these exceptions:

Nov 6, 2011 11:15:35 AM com.sun.jersey.spi.inject.Errors processErrorMessages
SEVERE: The following errors and warnings have been detected with resource and/or provider classes:
  SEVERE: The class com.sun.jersey.json.impl.provider.entity.JSONRootElementProvider does not have a public constructor and cannot be instantiated.
  SEVERE: The class com.sun.jersey.json.impl.provider.entity.JSONRootElementProvider does not have a public constructor and cannot be instantiated.
Exception in thread "main" com.sun.jersey.spi.inject.Errors$ErrorMessagesException
at com.sun.jersey.spi.inject.Errors.processErrorMessages(Errors.java:170)
at com.sun.jersey.spi.inject.Errors.postProcess(Errors.java:136)
at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:199)
at com.sun.jersey.api.client.Client.<init>(Client.java:187)
at com.sun.jersey.api.client.Client.<init>(Client.java:170)
at com.sun.jersey.api.client.Client.create(Client.java:679)

When trying to run code:

final ClientConfig config = new DefaultClientConfig();
config.getClasses().add(JSONRootElementProvider.class);
this.client = Client.create(config);

Is this still correct in Jersey 1.8? Or do I have to switch to the POJO model?

I need my services to remain using standard JAXBJSON Binding for backward compatibility reasons.
I hope that is okay?

Thanks for your help!

Ronak Patel