Search code examples
javacoldfusionapple-push-notificationscoldfusion-8javaapns

What is causing this error when using notnoop's java-apns library?


Code:

<cfset LOCAL.APNSService =
 CreateObject(
 "java",
 "com.notnoop.apns.APNS"
 ).newService(
 ).withCert(
 "MyCert.p12",
 ""
 ).withSandboxDestination().build() />

Exception:

java.io.IOException: failed to decrypt safe contents entry:
       java.lang.ArithmeticException: / by zero 

Stack Trace:

com.notnoop.exceptions.InvalidSSLConfig: java.io.IOException: failed to decrypt safe contents entry: java.lang.ArithmeticException: / by zero
   at com.notnoop.apns.internal.Utilities.newSSLContext(Utilities.java:102)
   at com.notnoop.apns.ApnsServiceBuilder.withCert(ApnsServiceBuilder.java:139)
   at com.notnoop.apns.ApnsServiceBuilder.withCert(ApnsServiceBuilder.java:114)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at coldfusion.runtime.StructBean.invoke(StructBean.java:511)
   at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2300)

Solution

  • This error was due to the fact that the apns lib requires the cert to have a password. Once a new cert with a password was used, the error stopped.