2

I am trying to send Apple push notification via Mobile First Server. I did that setup three months back and things were working fine. I start facing problem 4-5 days back that states java.lang.RuntimeException: Invalid hex character: y whenever I try to invoke push notification. The server logs are as given below.

000004ed com.ibm.pushworks.server.notification.Mediator               E FPWSE1081E: Failed sending notification. Please refer to the server log file for more details.
java.lang.RuntimeException: Invalid hex character: y
    at com.notnoop.apns.internal.Utilities.charval(Utilities.java:132)
    at com.notnoop.apns.internal.Utilities.decodeHex(Utilities.java:119)
    at com.notnoop.apns.internal.AbstractApnsService.push(AbstractApnsService.java:85)
    at com.notnoop.apns.internal.ApnsServiceImpl.push(ApnsServiceImpl.java:36)
    at com.ibm.pushworks.server.notification.apns.ApplicationConnection.sendNotification(ApplicationConnection.java:141)
    at com.ibm.pushworks.server.notification.apns.APNSMediator.sendNotification(APNSMediator.java:106)
    at com.ibm.pushworks.server.notification.Mediator$2.run(Mediator.java:89)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:483)
    at java.util.concurrent.FutureTask.run(FutureTask.java:274)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1157)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:627)
    at java.lang.Thread.run(Thread.java:809)

Please suggest something to remove this error.

Vittal Pai
  • 3,317
  • 25
  • 36
Akash Kumar
  • 165
  • 1
  • 12

2 Answers2

2

This issue can happen if the token you are using contains invalid hex characters.

Check whether you passing valid APNS token.

Use the following REST API : http://www.ibm.com/support/knowledgecenter/SSHS8R_7.0.0/com.ibm.worklight.apiref.doc/apiref/r_restapi_push_device_registration_get.html

to check the APNS token for your subscription. If the APNS token is proper, verify if you can send a push notification using REST APIs.

Vittal Pai
  • 3,317
  • 25
  • 36
  • We found the main cause of problem. That was happening because of ios10 upgrade. From Xcode, MFP was not getting proper deviceId after upgrade changes. I hope the issue will get resolved once , we will get proper deviceID. – Akash Kumar Sep 29 '16 at 12:06
  • @AkashKesarwani, are you referring to APNS device token ? Or the device id generated by MFP SDK? If you are referring to APNS token, please note that APNS gives the token and not MFP. – Vivin K Sep 29 '16 at 12:31
  • @VivinK I am referring to token generated by APNS, that Xcode uses to register itself to MFP. – Akash Kumar Sep 29 '16 at 12:42
  • 1
    @AkashKesarwani, XCode does not register to MFP. The iOS device obtains the token from APNS, and this will be accessible via the "didRegisterForRemoteNotificationsWithDeviceToken" method. MFP passes the token that reaches this method to the MFP server. In our tests, we have never seen a problem with APNS token obtained on iOS 10. Also , this would be a major breakdown of APNS and there have been no reports of APNS token issues on iOS 10. Revisit your code to see if you are changing,modifying or hardcoding the token anywhere. – Vivin K Sep 29 '16 at 15:11
  • @AkashKesarwani, Please accept the answer if the cause of problem is due to invalid APNS token. – Vittal Pai Sep 30 '16 at 04:52
  • @VittalPai and VivinK thanks for all your help. We resolved this issue. The root cause of the problem was ios upgrade of syntax when passing token to MFP server. – Akash Kumar Oct 01 '16 at 06:27
0

We had the same problem with version 7.0. For some reason there was an invalid token in the PUSH_DEVICES table with the following string "32bytes"

We removed that register and the registers related in the PUSH_NOTIFICATIONS table and everything worked fine after that.

  • This problem is related to the following questions: http://stackoverflow.com/questions/39495391/swift-3-device-tokens-are-now-being-parsed-as-32bytes http://stackoverflow.com/questions/9372815/how-can-i-convert-my-device-token-nsdata-into-an-nsstring – Miguel Troncoso May 09 '17 at 17:53