users@jersey.java.net

[Jersey] Re: Need help with weird error with jersey and jackson

From: Saroj Kumar <sarojk_at_gmail.com>
Date: Thu, 25 Oct 2012 15:50:57 -0700

Thanks Glen for your inputs

Problem is random. I have not been able to reproduce it consistently.
Sometimes, we get this error but not all the time.

We are using JAXB for converting Java objects into JSON. I don't know if
jaxb support will use Jackson or Jettison/

Our web.xml is like this

  <servlet>
    <servlet-name>Jersey Spring Web Application</servlet-name>

<servlet-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</servlet-class>

    <init-param>

<param-name>com.sun.ws.rest.config.property.resourceConfigClass</param-name>

<param-value>com.sun.ws.rest.api.core.PackagesResourceConfig</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
  </servlet>

Please advise.

Thanks
Saroj

On Thu, Oct 25, 2012 at 1:50 PM, Glen Mazza <gmazza_at_talend.com> wrote:

> This is looking for a needle in a haystack, it would be good if you
> could shrink the query to the minimum that consistently reproduces the
> problem. No, Jersey uses either Jettison or Jackson depending on how you
> configure it (
> http://jersey.java.net/nonav/documentation/latest/user-guide.html#json).
> mvn dependency:tree should let you know if you're using Jackson (if you
> don't see Jackson you're not), also the jacksonjsonprovider sample (
> http://www.jroller.com/gmazza/entry/jersey_samples_on_cxf) shows how you
> can switch to Jackson, maybe the problem will go away then.
>
> Glen
>
>
> On 10/25/2012 04:36 PM, Saroj Kumar wrote:
>
> Hi There
>
>
> We are using Jersey 1.1.5 and finding that jersey is returning a JSON
> response which is valid most of the times but, there are sometime when we
> are getting an extra “}” which makes it an invalid json response.
>
>
>
> I understand Jersey’s json support is based on Jackson library. Can you
> please point me in the right direction?
>
>
>
> I am attaching samples of good and bad json, with this email.
>
>
> Please advise.
>
>
> Thanks in advance.
>
>
>
> -Saroj
>
>
>
> --
> Glen Mazza
> Talend Community Coders - coders.talend.com
> blog: www.jroller.com/gmazza
>
>