users@jersey.java.net

[Jersey] Re: Jersey Client JSONRootElementProvider

From: Ronak Patel <ronak2121_at_yahoo.com>
Date: Mon, 7 Nov 2011 02:13:21 -0800 (PST)

Hi Jakub,

Thanks for your reply,

So I tried what you suggested, but I don't see Jersey actually marshalling the JSON string into my JAXB Object. All of the fields of the object are blank even if they are present in the JSON.

Any ideas?

Thanks,

Ronak


________________________________
From: Jakub Podlesak <jakub.podlesak_at_oracle.com>
To: users_at_jersey.java.net
Sent: Monday, November 7, 2011 3:54 AM
Subject: [Jersey] Re: Jersey Client JSONRootElementProvider


Hello Ronak,

You do not need to explicitly add the JSONRootElementProvider to your client configuration.
It should be sufficient to just add the jersey-json module to your
      dependencies.
I.e. just try to remove the following line from your code:
config.getClasses().add(JSONRootElementProvider.class);

Does it work? If not, could you please send some more details on
        what you expect
and what you are getting instead?

Thanks,

~Jakub



On 6.11.2011 17:21, Ronak Patel wrote:
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
>
>
>
>