users@jersey.java.net

can't consume json with natural notation

From: Bo Xu <bobxu1128_at_gmail.com>
Date: Thu, 22 Jul 2010 11:53:06 -0700 (PDT)

I can produce natural notation json without any problems and the project is
in production for weeks. But recently we have the requirement to consume
json. when I try to curl it:
curl -X POST -H "Content-Type:application/json" -d
'{"code":"-1","message":"An"}' "http://localhost:8080/spruceapi/echo" -w
'\n%{http_code}\n'

all I can get is like this:
java.lang.NoSuchFieldError: _currToken
        at
com.sun.jersey.json.impl.reader.JacksonRootAddingParser.nextToken(JacksonRootAddingParser.java:157)
        at
com.sun.jersey.json.impl.reader.Jackson2StaxReader.readNext(Jackson2StaxReader.java:161)
        at
com.sun.jersey.json.impl.reader.Jackson2StaxReader.readNext(Jackson2StaxReader.java:126)
        at
com.sun.jersey.json.impl.reader.Jackson2StaxReader.<init>(Jackson2StaxReader.java:114)
        at
com.sun.jersey.json.impl.Stax2JsonFactory.createReader(Stax2JsonFactory.java:117)
        at
com.sun.jersey.json.impl.Stax2JsonFactory.createReader(Stax2JsonFactory.java:107)
        at
com.sun.jersey.json.impl.BaseJSONUnmarshaller.createXmlStreamReader(BaseJSONUnmarshaller.java:107)
        at
com.sun.jersey.json.impl.BaseJSONUnmarshaller.unmarshalJAXBElementFromJSON(BaseJSONUnmarshaller.java:103)
        at
com.sun.jersey.json.impl.BaseJSONUnmarshaller.unmarshalFromJSON(BaseJSONUnmarshaller.java:92)
        at
com.sun.jersey.json.impl.provider.entity.JSONRootElementProvider.readFrom(JSONRootElementProvider.java:98)
        at
com.sun.jersey.core.provider.jaxb.AbstractRootElementProvider.readFrom(AbstractRootElementProvider.java:105)
        at
com.sun.jersey.spi.container.ContainerRequest.getEntity(ContainerRequest.java:410)
        at
com.sun.jersey.server.impl.model.method.dispatch.EntityParamDispatchProvider$EntityInjectable.getValue(EntityParamDispatchProvider.java:137)
        at
com.sun.jersey.server.impl.inject.InjectableValuesProvider.getInjectableValues(InjectableValuesProvider.java:43)
        at
com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$EntityParamInInvoker.getParams(AbstractResourceMethodDispatchProvider.java:126)
        at
com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:154)
        at
com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:67)
        at
com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:208)
        at
com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:75)
        at
com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:115)
        at
com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:67)
        at
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:771)
        at
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:736)
        at
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:727)
        at
com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:368)
        at
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:452)
        at
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:633)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

If I changed natural notation to default mapped, then everything works.
Any idea? Thanks a million!
-- 
View this message in context: http://jersey.576304.n2.nabble.com/can-t-consume-json-with-natural-notation-tp5326726p5326726.html
Sent from the Jersey mailing list archive at Nabble.com.