users@jersey.java.net

Re: [Jersey] JsonGenerationException: Can not write text value, expecting field name

From: Farrukh Najmi <farrukh_at_wellfleetsoftware.com>
Date: Fri, 18 Sep 2009 12:36:26 -0400

Hi Jakub,

I wanted to share the good news that I was able to verify your recent
fix for this issue <https://jersey.dev.java.net/issues/show_bug.cgi?id=311>
appears to vbe working nicely. Thanks very much for your patient help is
getting to the bottom of this problem. Jersey is one of the best and
most responsive open source projects I have used and I am one very happy
user of it. Thanks again.

Farrukh Najmi wrote:
> Hi Guys,
>
> My jersey 1.1.1-ea-SNAPSHOT based server returns an XML document in
> response to a request that specifies a query when the query parameter
> "format=application/xml". It returns the equivalent JSON document when
> the query parameter "format=application/json".
>
> Thing work for certain queries fine. However, on certain queries I get
> the following stack trace below for "format=application/json" but not
> for "format=application/xml".
>
> I tried turning on jersey logging using Jakub's suggestion here:
>
> <http://markmail.org/message/qwb57fksrtueox7h#query:jersey%20java%20logging+page:1+mid:fcmc5xvktvcrutns+state:results>
>
>
> I did not see any log output.
>
> Any suggestions on how best to debug this?
>
> java.io.IOException: Error marshalling JAXB object of type "class
> org.freebxml.omar.jaxb.bindings.query._4_0.QueryResponse".
> com.sun.jersey.core.provider.jaxb.AbstractRootElementProvider.writeTo(AbstractRootElementProvider.java:145)
>
> com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:254)
>
> com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:693)
>
> com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:616)
>
> com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:607)
>
> com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:309)
>
> com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:425)
>
> com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:590)
>
> javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
> org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
>
>
> *root cause*
>
> javax.xml.bind.MarshalException
> - with linked exception:
> [net.sf.saxon.trans.DynamicError: javax.xml.stream.XMLStreamException:
> org.codehaus.jackson.JsonGenerationException: Can not write text
> value, expecting field name]


-- 
Regards,
Farrukh
Web: http://www.wellfleetsoftware.com