I’m new to this. I generated Certificate Signing Request as in here
. Then I used that certificate file which is in .p12 format to establish a connection to Apple push notification server via java-apns
. Here is the code that I have used.
ApnsService service = APNS.newService() .withCert("/home/ApplePush/apple.p12", "abc") .withProductionDestination() .build(); service.testConnection();
But when I run this code it gives me following esception.
“Exception in thread “main” com.notnoop.exceptions.NetworkIOException: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure”.
What is the wrong I have done?
Hi I have had the exact same problem. Like you, I have followed raywenderlinch tutorial and used java-apns library in the backend to communicate with APNS. The certificates thing in the tutorial are focused for php and they are doing something with .pem files which is not needed for java-apns invocation.
I was feeding java-apns with the first .p12 certificate that you create at the beginning of the tutorial. And that was my mistake. What you need to do is generate the .p12 from the certificate generated by apple (aps_developer_identity.cer). Double-click on it and in the keystore manager mac app export as .p12 use some password and try to connect with java-apns using this .p12 and password.
Of course everything related to provisioning portal explained in the ray tutorial must be done correctly.
Thats what has solved my sslHandShakeException. I dont know if you are having the exact same problem but hope it is and this information could help you.