users@jersey.java.net

[Jersey] Re: ObjectMapper.writeValueAsString causes java.lang.IllegalStateException

From: Jakub Podlesak <jakub.podlesak_at_oracle.com>
Date: Tue, 24 Mar 2015 18:39:46 +0100

Btw. not sure if you are aware of this:

you could stick with Jackson 1.x, see https://jersey.java.net/documentation/latest/media.html#json.jackson <https://jersey.java.net/documentation/latest/media.html#json.jackson> for details.

~Jakub

> On 24 Mar 2015, at 18:32, Jakub Podlesak <jakub.podlesak_at_oracle.com> wrote:
>
> Hi Pritam,
>
> Not sure. Would you mind sharing a bit more information on your bean and your method?
> Source code snippet will work best.
>
> Have you tried to ask at the Jacskon forum, http://jackson-users.ning.com/forum <http://jackson-users.ning.com/forum>?
>
> Cheers,
>
> ~Jakub
>
>
>> On 24 Mar 2015, at 18:17, Pritam Moodbidri <pritam_at_yahoo-inc.com <mailto:pritam_at_yahoo-inc.com>> wrote:
>>
>> Hi,
>>
>> I am upgrading Jersey from 2.7 to 2.17, and also relatively Jackson from 1.x to 2.x.
>>
>> One of the function was using ObjectMapper.writeValueAsString, and using the bean as an argument. The bean is using @JsonProperty for an element in it, which has a different name, than the element variable name, which is throwing the exception
>>
>> java.lang.IllegalStateException: Conflicting/ambiguous property name definitions (implicit name 'myElements'): found multiple explicit names: [myElements, my_elements], but also implicit accessor: [field .....#myElements][visible=false,ignore=false,explicitName=false]
>>
>> Do I need to add something more with Jersey 2.17?
>>
>> - Pritam
>