Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting com.fasterxml.jackson.databind.JsonMappingException: (was java.lang.NullPointerException) error while sending WNS Tile or Toast #22

Open
nirav9261 opened this issue Dec 22, 2016 · 3 comments

Comments

@nirav9261
Copy link

Getting below error while sending WNS Tile or Toast even after installing libraries with dependencies.

Exception : com.fasterxml.jackson.databind.JsonMappingException: (was java.lang.NullPointerException) (through reference chain: ar.com.fernandospr.wns.model.WnsTile["visual"]->ar.com.fernandospr.wns.model.WnsVisual["binding"]->ar.com.fernandospr.wns.model.WnsBinding["text"]->java.util.ArrayList[0]->ar.com.fernandospr.wns.model.WnsText["id"])
javax.ws.rs.ProcessingException: com.fasterxml.jackson.databind.JsonMappingException: (was java.lang.NullPointerException) (through reference chain: ar.com.fernandospr.wns.model.WnsTile["visual"]->ar.com.fernandospr.wns.model.WnsVisual["binding"]->ar.com.fernandospr.wns.model.WnsBinding["text"]->java.util.ArrayList[0]->ar.com.fernandospr.wns.model.WnsText["id"])
at org.glassfish.jersey.client.HttpUrlConnector.apply(HttpUrlConnector.java:245)
at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:246)
at org.glassfish.jersey.client.JerseyInvocation$1.call(JerseyInvocation.java:667)
at org.glassfish.jersey.client.JerseyInvocation$1.call(JerseyInvocation.java:664)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.process(Errors.java:228)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:444)
at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:664)
at ar.com.fernandospr.wns.client.WnsClient.push(WnsClient.java:135)
at ar.com.fernandospr.wns.WnsService.pushTile(WnsService.java:84)
at ar.com.fernandospr.wns.WnsService.pushTile(WnsService.java:72)
at com.tcs.sgv.communication.bo.CmnCommunicationBO.WNSBroadCast(CmnCommunicationBO.java:1111)
at com.tcs.sgv.communication.bo.CmnCommunicationBO.sendPushNotification(CmnCommunicationBO.java:856)
at com.tcs.sgv.communication.zk.composer.NewCommunicationComposer.onClick$btnSave(NewCommunicationComposer.java:354)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.zkoss.zk.ui.event.GenericEventListener.onEvent(GenericEventListener.java:87)
at com.tcs.sgv.zk.common.composer.GenericComposer.onEvent(GenericComposer.java:424)
at org.zkoss.zk.ui.impl.EventProcessor.process0(EventProcessor.java:193)
at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:138)
at org.zkoss.zk.ui.impl.EventProcessingThreadImpl.process0(EventProcessingThreadImpl.java:518)
at org.zkoss.zk.ui.impl.EventProcessingThreadImpl.sendEvent(EventProcessingThreadImpl.java:121)
at org.zkoss.zk.ui.event.Events.sendEvent(Events.java:318)
at org.zkoss.zk.ui.event.Events.sendEvent(Events.java:329)
at org.zkoss.zk.ui.AbstractComponent$ForwardListener.onEvent(AbstractComponent.java:3022)
at org.zkoss.zk.ui.impl.EventProcessor.process0(EventProcessor.java:193)
at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:138)
at org.zkoss.zk.ui.impl.EventProcessingThreadImpl.process0(EventProcessingThreadImpl.java:518)
at org.zkoss.zk.ui.impl.EventProcessingThreadImpl.run(EventProcessingThreadImpl.java:444)
Caused by: com.fasterxml.jackson.databind.JsonMappingException: (was java.lang.NullPointerException) (through reference chain: ar.com.fernandospr.wns.model.WnsTile["visual"]->ar.com.fernandospr.wns.model.WnsVisual["binding"]->ar.com.fernandospr.wns.model.WnsBinding["text"]->java.util.ArrayList[0]->ar.com.fernandospr.wns.model.WnsText["id"])
at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:210)
at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:177)
at com.fasterxml.jackson.databind.ser.std.StdSerializer.wrapAndThrow(StdSerializer.java:190)
at com.fasterxml.jackson.dataformat.xml.ser.XmlBeanSerializerBase.serializeFields(XmlBeanSerializerBase.java:219)
at com.fasterxml.jackson.dataformat.xml.ser.XmlBeanSerializer.serialize(XmlBeanSerializer.java:119)
at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serializeContents(IndexedListSerializer.java:113)
at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serialize(IndexedListSerializer.java:73)
at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serialize(IndexedListSerializer.java:19)
at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:575)
at com.fasterxml.jackson.dataformat.xml.ser.XmlBeanSerializerBase.serializeFields(XmlBeanSerializerBase.java:202)
at com.fasterxml.jackson.dataformat.xml.ser.XmlBeanSerializer.serialize(XmlBeanSerializer.java:119)
at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:575)
at com.fasterxml.jackson.dataformat.xml.ser.XmlBeanSerializerBase.serializeFields(XmlBeanSerializerBase.java:202)
at com.fasterxml.jackson.dataformat.xml.ser.XmlBeanSerializer.serialize(XmlBeanSerializer.java:119)
at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:575)
at com.fasterxml.jackson.dataformat.xml.ser.XmlBeanSerializerBase.serializeFields(XmlBeanSerializerBase.java:202)
at com.fasterxml.jackson.dataformat.xml.ser.XmlBeanSerializer.serialize(XmlBeanSerializer.java:119)
at com.fasterxml.jackson.dataformat.xml.ser.XmlSerializerProvider.serializeValue(XmlSerializerProvider.java:92)
at com.fasterxml.jackson.databind.ObjectWriter.writeValue(ObjectWriter.java:851)
at com.fasterxml.jackson.jaxrs.base.ProviderBase.writeTo(ProviderBase.java:648)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.invokeWriteTo(WriterInterceptorExecutor.java:265)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.aroundWriteTo(WriterInterceptorExecutor.java:250)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162)
at org.glassfish.jersey.filter.LoggingFilter.aroundWriteTo(LoggingFilter.java:295)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162)
at org.glassfish.jersey.message.internal.MessageBodyFactory.writeTo(MessageBodyFactory.java:1118)
at org.glassfish.jersey.client.ClientRequest.writeEntity(ClientRequest.java:503)
at org.glassfish.jersey.client.HttpUrlConnector._apply(HttpUrlConnector.java:331)
at org.glassfish.jersey.client.HttpUrlConnector.apply(HttpUrlConnector.java:243)
at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:246)
at org.glassfish.jersey.client.JerseyInvocation$1.call(JerseyInvocation.java:667)
at org.glassfish.jersey.client.JerseyInvocation$1.call(JerseyInvocation.java:664)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.process(Errors.java:228)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:444)
at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:664)
at ar.com.fernandospr.wns.client.WnsClient.push(WnsClient.java:135)
at ar.com.fernandospr.wns.WnsService.pushTile(WnsService.java:84)
at ar.com.fernandospr.wns.WnsService.pushTile(WnsService.java:72)
at com.tcs.sgv.communication.bo.CmnCommunicationBO.WNSBroadCast(CmnCommunicationBO.java:1109)
at com.tcs.sgv.communication.bo.CmnCommunicationBO.sendPushNotification(CmnCommunicationBO.java:856)
at com.tcs.sgv.communication.zk.composer.NewCommunicationComposer.onClick$btnSave(NewCommunicationComposer.java:354)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.zkoss.zk.ui.event.GenericEventListener.onEvent(GenericEventListener.java:87)
at com.tcs.sgv.zk.common.composer.GenericComposer.onEvent(GenericComposer.java:424)
at org.zkoss.zk.ui.impl.EventProcessor.process0(EventProcessor.java:192)
at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:138)
at org.zkoss.zk.ui.impl.EventProcessingThreadImpl.process0(EventProcessingThreadImpl.java:517)
at org.zkoss.zk.ui.impl.EventProcessingThreadImpl.sendEvent(EventProcessingThreadImpl.java:121)
at org.zkoss.zk.ui.event.Events.sendEvent(Events.java:318)
at org.zkoss.zk.ui.event.Events.sendEvent(Events.java:328)
at org.zkoss.zk.ui.AbstractComponent$ForwardListener.onEvent(AbstractComponent.java:3022)
at org.zkoss.zk.ui.impl.EventProcessor.process0(EventProcessor.java:192)
at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:138)
at org.zkoss.zk.ui.impl.EventProcessingThreadImpl.process0(EventProcessingThreadImpl.java:517)
... 1 more
Caused by: java.lang.NullPointerException
at java.io.Writer.write(Writer.java:140)
at weblogic.xml.stax.XMLWriterBase.write(XMLWriterBase.java:79)
at weblogic.xml.stax.XMLWriterBase.writeName(XMLWriterBase.java:294)
at weblogic.xml.stax.XMLWriterBase.writeAttribute(XMLWriterBase.java:567)
at org.codehaus.stax2.ri.Stax2WriterAdapter.writeIntAttribute(Stax2WriterAdapter.java:191)
at com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator.writeNumber(ToXmlGenerator.java:759)
at com.fasterxml.jackson.databind.ser.std.NumberSerializers$IntegerSerializer.serialize(NumberSerializers.java:143)
at com.fasterxml.jackson.databind.ser.std.NumberSerializers$IntegerSerializer.serialize(NumberSerializers.java:136)
at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:575)
at com.fasterxml.jackson.dataformat.xml.ser.XmlBeanSerializerBase.serializeFields(XmlBeanSerializerBase.java:202)
... 56 more

@nirav9261
Copy link
Author

Written below code to push from server.

boolean logging = true;
String sid = "mySID";
String clientSecret = "clientSecret";
WnsService service = new WnsService(sid, clientSecret, logging);

  String channelUri = data.get("tokenId").toString();
  if ((data.get("Title") != null) && (data.get("Content") != null))
  {
    WnsTile tile = new WnsTileBuilder().bindingTemplateTileWideText03("Hello world").build();
    service.pushTile(channelUri, tile);

    WnsBadge badge = new WnsBadgeBuilder().value(Integer.valueOf(1)).build();
    service.pushBadge(channelUri, badge);

    WnsToast toast = new WnsToastBuilder().bindingTemplateToastText02(data.get("Title").toString(), data.get("Content").toString()).build();
    WnsNotificationResponse wnsResponse = service.pushToast(channelUri, toast);

}

From references found online, it seems I need to amend code in java-wns.jar.

Can you please help.

Thanks.

@nirav9261
Copy link
Author

@fernandospr : can you please look in issue I am facing. Thanks.

@fernandospr
Copy link
Owner

Hi @nirav9261, sorry for the delay in the response.
Unfortunately, it's difficult for me to continue giving support on this library as I don't have a device to test. However, if you want, you can develop the fix and submit a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants