users@jersey.java.net

[Jersey] Jersey Client JSONRootElementProvider

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

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