dev@jersey.java.net

Re: [Jersey] .reader.Jackson2StaxReader getAttributeCount Exception

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Fri, 22 May 2009 08:58:45 +0200

Hi Sanju,

What version of Jersey are you using? 1.0.3 or 1.1.0-ea ?

Can you please send more information on the JAXB objects you are
using, preferably some code that reproduces the test case.

Paul.


On May 22, 2009, at 4:48 AM, sanju wrote:

>
> Hi All,
> I am getting following exception when trying to use REST/HTTP PUT
> operation with JSON MIME type ( while the same PUT operation works
> fine for the same REST service)
> May 21, 2009 7:16:12 PM
> com.sun.jersey.json.impl.reader.Jackson2StaxReader getAttributeCount
> SEVERE: null
> java.io.IOException: Not an attribute, expected primitive value!
> at
> com
> .sun
> .jersey
> .json
> .impl.reader.Jackson2StaxReader.readNext(Jackson2StaxReader.java:145)
> at
> com
> .sun
> .jersey
> .json
> .impl
> .reader.Jackson2StaxReader.getAttributeCount(Jackson2StaxReader.java:
> 301)
> at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector
> $1.getLength(StAXStreamConnector.java:250)
> at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector
> $1.getIndex(StAXStreamConnector.java:280)
> at com.sun.xml.bind.v2.runtime.unmarshaller.InterningXmlVisitor
> $AttributesImpl.getIndex(InterningXmlVisitor.java:112)
> at
> com
> .sun
> .xml
> .bind
> .v2
> .runtime.unmarshaller.XsiTypeLoader.parseXsiType(XsiTypeLoader.java:
> 82)
> at
> com
> .sun
> .xml
> .bind
> .v2
> .runtime.unmarshaller.XsiTypeLoader.startElement(XsiTypeLoader.java:
> 67)
> at
> com
> .sun
> .xml
> .bind
> .v2
> .runtime
> .unmarshaller
> .UnmarshallingContext._startElement(UnmarshallingContext.java:481)
> at
> com
> .sun
> .xml
> .bind
> .v2
> .runtime
> .unmarshaller
> .UnmarshallingContext.startElement(UnmarshallingContext.java:459)
> at
> com
> .sun
> .xml
> .bind
> .v2
> .runtime
> .unmarshaller
> .InterningXmlVisitor.startElement(InterningXmlVisitor.java:71)
> at
> com
> .sun
> .xml
> .bind
> .v2
> .runtime
> .unmarshaller
> .StAXStreamConnector.handleStartElement(StAXStreamConnector.java:242)
> at
> com
> .sun
> .xml
> .bind
> .v2
> .runtime
> .unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:176)
> at
> com
> .sun
> .xml
> .bind
> .v2
> .runtime
> .unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:360)
> at
> com
> .sun
> .xml
> .bind
> .v2
> .runtime
> .unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:339)
> at
> com
> .sun
> .jersey.json.impl.JSONUnmarshaller.unmarshal(JSONUnmarshaller.java:
> 100)
> at
> com
> .sun
> .jersey
> .json
> .impl
> .provider
> .entity
> .JSONRootElementProvider.readFrom(JSONRootElementProvider.java:104)
> at
> com
> .sun
> .jersey
> .core
> .provider
> .jaxb
> .AbstractRootElementProvider
> .readFrom(AbstractRootElementProvider.java:97)
> at
> com
> .sun
> .jersey
> .spi.container.ContainerRequest.getEntity(ContainerRequest.java:391)
> at
> com
> .sun
> .jersey.server.impl.model.method.dispatch.EntityParamDispatchProvider
> $EntityInjectable.getValue(EntityParamDispatchProvider.java:81)
> at
> com
> .sun
> .jersey.server.impl.model.method.dispatch.EntityParamDispatchProvider
> $EntityParamInInvoker.getParams(EntityParamDispatchProvider.java:99)
> at
> com
> .sun
> .jersey.server.impl.model.method.dispatch.EntityParamDispatchProvider
> $VoidOutInvoker._dispatch(EntityParamDispatchProvider.java:120)
> 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:154)
> at
> com
> .sun
> .jersey
> .server
> .impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:71)
> at
> com
> .sun
> .jersey
> .server
> .impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:111)
> at
> com
> .sun
> .jersey
> .server
> .impl
> .uri
> .rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:63)
> at
> com
> .sun
> .jersey
> .server
> .impl
> .application
> .WebApplicationImpl._handleRequest(WebApplicationImpl.java:543)
> at
> com
> .sun
> .jersey
> .server
> .impl
> .application
> .WebApplicationImpl.handleRequest(WebApplicationImpl.java:502)
> at
> com
> .sun
> .jersey
> .server
> .impl
> .application
> .WebApplicationImpl.handleRequest(WebApplicationImpl.java:493)
> at
> com
> .sun
> .jersey.spi.container.servlet.WebComponent.service(WebComponent.java:
> 308)
> at
> com
> .sun
> .jersey
> .spi
> .container.servlet.ServletContainer.service(ServletContainer.java:314)
> at
> com
> .sun
> .jersey
> .spi
> .container.servlet.ServletContainer.service(ServletContainer.java:239)
> at
> org
> .apache
> .catalina
> .core
> .ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
> 290)
> at
> org
> .apache
> .catalina
> .core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> at
> org
> .apache
> .catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
> 228)
> at
> org
> .apache
> .catalina.core.StandardContextValve.invoke(StandardContextValve.java:
> 175)
> at
> org
> .apache
> .catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
> at
> org
> .apache
> .catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
> at
> org
> .apache
> .catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:
> 109)
> at
> org
> .apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:
> 212)
> at
> org
> .apache.coyote.http11.Http11Processor.process(Http11Processor.java:
> 844)
> at org.apache.coyote.http11.Http11Protocol
> $Http11ConnectionHandler.process(Http11Protocol.java:634)
> at org.apache.tomcat.util.net.JIoEndpoint
> $Worker.run(JIoEndpoint.java:445)
> at java.lang.Thread.run(Thread.java:619)
> May 21, 2009 7:16:12 PM
> org.apache.catalina.core.StandardWrapperValve invoke
> SEVERE: Servlet.service() for servlet JerseyRestServlet threw
> exception
> java.lang.NullPointerException
> at
> com
> .sun
> .org
> .apache.xalan.internal.xsltc.trax.SAX2DOM.startElement(SAX2DOM.java:
> 195)
> at
> com
> .sun
> .org
> .apache
> .xml
> .internal
> .serializer.ToXMLSAXHandler.closeStartTag(ToXMLSAXHandler.java:204)
> at
> com
> .sun
> .org
> .apache
> .xml.internal.serializer.ToSAXHandler.flushPending(ToSAXHandler.java:
> 277)
> at
> com
> .sun
> .org
> .apache
> .xml
> .internal.serializer.ToXMLSAXHandler.endElement(ToXMLSAXHandler.java:
> 243)
> at
> com
> .sun
> .org
> .apache
> .xalan
> .internal
> .xsltc
> .trax.TransformerHandlerImpl.endElement(TransformerHandlerImpl.java:
> 273)
> at
> com
> .sun
> .xml
> .bind.v2.runtime.unmarshaller.DomLoader.leaveElement(DomLoader.java:
> 150)
> at
> com
> .sun
> .xml
> .bind
> .v2
> .runtime
> .unmarshaller
> .UnmarshallingContext.endElement(UnmarshallingContext.java:506)
> at
> com
> .sun
> .xml
> .bind
> .v2
> .runtime
> .unmarshaller
> .InterningXmlVisitor.endElement(InterningXmlVisitor.java:77)
> at
> com
> .sun
> .xml
> .bind
> .v2
> .runtime
> .unmarshaller
> .StAXStreamConnector.handleEndElement(StAXStreamConnector.java:217)
> at
> com
> .sun
> .xml
> .bind
> .v2
> .runtime
> .unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:181)
> at
> com
> .sun
> .xml
> .bind
> .v2
> .runtime
> .unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:360)
> at
> com
> .sun
> .xml
> .bind
> .v2
> .runtime
> .unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:339)
> at
> com
> .sun
> .jersey.json.impl.JSONUnmarshaller.unmarshal(JSONUnmarshaller.java:
> 100)
> at
> com
> .sun
> .jersey
> .json
> .impl
> .provider
> .entity
> .JSONRootElementProvider.readFrom(JSONRootElementProvider.java:104)
> at
> com
> .sun
> .jersey
> .core
> .provider
> .jaxb
> .AbstractRootElementProvider
> .readFrom(AbstractRootElementProvider.java:97)
> at
> com
> .sun
> .jersey
> .spi.container.ContainerRequest.getEntity(ContainerRequest.java:391)
> at
> com
> .sun
> .jersey.server.impl.model.method.dispatch.EntityParamDispatchProvider
> $EntityInjectable.getValue(EntityParamDispatchProvider.java:81)
> at
> com
> .sun
> .jersey.server.impl.model.method.dispatch.EntityParamDispatchProvider
> $EntityParamInInvoker.getParams(EntityParamDispatchProvider.java:99)
> at
> com
> .sun
> .jersey.server.impl.model.method.dispatch.EntityParamDispatchProvider
> $VoidOutInvoker._dispatch(EntityParamDispatchProvider.java:120)
> 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:154)
> at
> com
> .sun
> .jersey
> .server
> .impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:71)
> at
> com
> .sun
> .jersey
> .server
> .impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:111)
> at
> com
> .sun
> .jersey
> .server
> .impl
> .uri
> .rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:63)
> at
> com
> .sun
> .jersey
> .server
> .impl
> .application
> .WebApplicationImpl._handleRequest(WebApplicationImpl.java:543)
> at
> com
> .sun
> .jersey
> .server
> .impl
> .application
> .WebApplicationImpl.handleRequest(WebApplicationImpl.java:502)
> at
> com
> .sun
> .jersey
> .server
> .impl
> .application
> .WebApplicationImpl.handleRequest(WebApplicationImpl.java:493)
> at
> com
> .sun
> .jersey.spi.container.servlet.WebComponent.service(WebComponent.java:
> 308)
> at
> com
> .sun
> .jersey
> .spi
> .container.servlet.ServletContainer.service(ServletContainer.java:314)
> at
> com
> .sun
> .jersey
> .spi
> .container.servlet.ServletContainer.service(ServletContainer.java:239)
> at
> org
> .apache
> .catalina
> .core
> .ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
> 290)
> at
> org
> .apache
> .catalina
> .core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> at
> org
> .apache
> .catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
> 228)
> at
> org
> .apache
> .catalina.core.StandardContextValve.invoke(StandardContextValve.java:
> 175)
> at
> org
> .apache
> .catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
> at
> org
> .apache
> .catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
> at
> org
> .apache
> .catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:
> 109)
> at
> org
> .apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:
> 212)
> at
> org
> .apache.coyote.http11.Http11Processor.process(Http11Processor.java:
> 844)
> at org.apache.coyote.http11.Http11Protocol
> $Http11ConnectionHandler.process(Http11Protocol.java:634)
> at org.apache.tomcat.util.net.JIoEndpoint
> $Worker.run(JIoEndpoint.java:445)
> at java.lang.Thread.run(Thread.java:619)
>
> Can anyone help me ?
>
> -Sanju
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: dev-help_at_jersey.dev.java.net
>