我正在尝试使用 xtify 向 android 和 iOS 发送推送通知。我能够做到这一点,但是,有效负载信息似乎对我不起作用。如果我删除有效负载,请求会成功,但添加有效负载会导致服务器错误。谁能看看我发送的 json 并告诉我是否做错了什么?
{
"apiKey":"...",
"appKey":"...",
"xids":[
"..."
],
"content":{
"subject":"chat from billy bob",
"message":"hey",
"payload":{
"UserId":"1",
"DeviceId":"9"
}
}
}
这是服务器返回的错误:HTTP/1.1 500 Internal Server Error Date: Wed, 30 May 2012 22:51:51 GMT Content-Type: text/html;charset=utf-8 Content-Length: 5839 Connection: close
JBoss Web/2.1.3.GA - 错误报告
HTTP 状态 500 -
类型异常报告
信息
描述服务器遇到一个内部错误 () 阻止它完成这个请求。
例外
javax.servlet.ServletException: org.codehaus.jackson.map.JsonMappingException: 无法从 START_OBJECT 令牌中反序列化 java.lang.String 的实例 在 [来源:org.apache.catalina.connector.CoyoteInputStream@210c8d4e;行:1,列:199](通过引用链:com.xtify.api.entities.PushRequest["content"]->com.xtify.api.entities.Content["payload"]) com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:418) com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537) com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:708) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
根本原因
org.codehaus.jackson.map.JsonMappingException:无法从 START_OBJECT 令牌中反序列化 java.lang.String 的实例 在 [来源:org.apache.catalina.connector.CoyoteInputStream@210c8d4e;行:1,列:199](通过引用链:com.xtify.api.entities.PushRequest["content"]->com.xtify.api.entities.Content["payload"]) org.codehaus.jackson.map.JsonMappingException.from(JsonMappingException.java:163) org.codehaus.jackson.map.deser.StdDeserializationContext.mappingException(StdDeserializationContext.java:219) org.codehaus.jackson.map.deser.std.StringDeserializer.deserialize(StringDeserializer.java:44) org.codehaus.jackson.map.deser.std.StringDeserializer.deserialize(StringDeserializer.java:13) org.codehaus.jackson.map.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:299) org.codehaus.jackson.map.deser.SettableBeanProperty$MethodProperty.deserializeAndSet(SettableBeanProperty.java:414) org.codehaus.jackson.map.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:697) org.codehaus.jackson.map.deser.BeanDeserializer.deserialize(BeanDeserializer.java:580) org.codehaus.jackson.map.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:299) org.codehaus.jackson.map.deser.SettableBeanProperty$MethodProperty.deserializeAndSet(SettableBeanProperty.java:414) org.codehaus.jackson.map.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:697) org.codehaus.jackson.map.deser.BeanDeserializer.deserialize(BeanDeserializer.java:580) org.codehaus.jackson.map.ObjectMapper._readValue(ObjectMapper.java:2704) org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1315) org.codehaus.jackson.jaxrs.JacksonJsonProvider.readFrom(JacksonJsonProvider.java:419) com.sun.jersey.json.impl.provider.entity.JacksonProviderProxy.readFrom(JacksonProviderProxy.java:139) com.sun.jersey.spi.container.ContainerRequest.getEntity(ContainerRequest.java:474) com.sun.jersey.server.impl.model.method.dispatch.EntityParamDispatchProvider$EntityInjectable.getValue(EntityParamDispatchProvider.java:123) com.sun.jersey.server.impl.inject.InjectableValuesProvider.getInjectableValues(InjectableValuesProvider.java:46) com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$EntityParamInInvoker.getParams(AbstractResourceMethodDispatchProvider.java:153) com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:203) com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75) com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288) com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108) com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147) com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84) com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1483) com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1414) com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1363) com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1353) com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:414) com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537) com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:708) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
note根本原因的完整堆栈跟踪可在 JBoss Web/2.1.3.GA 日志中找到。