mwkirk / javapns

Test import of svn javapns repo from Google Code
3 stars 0 forks source link

getting javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure #147

Closed mwkirk closed 11 years ago

mwkirk commented 11 years ago

Original author: mahendr...@gmail.com (September 28, 2012 17:12:44)

What steps will reproduce the problem?

  1. Created certificates from mac machine
  2. in tomcat server application using JavaPNS to send the notification Used Push.alert(...) used .p12 file

As per the mentioned documents I have installed the .cer doenloaded from developer.apple and generated .pem file intstalled on windows server

Used latest 2.2 version

2012-09-28 21:03:38,466 INFO javapns.notification.PushNotificationManager.sendNotification:433 - Attempt failed (Received fatal alert: handshake_failure)... trying again 44249 [Thread-36] INFO javapns.notification.PushNotificationManager - Attempt failed (Received fatal alert: handshake_failure)... trying again 2012-09-28 21:03:39,265 INFO javapns.notification.PushNotificationManager.sendNotification:433 - Attempt failed (Received fatal alert: handshake_failure)... trying again 45048 [Thread-36] INFO javapns.notification.PushNotificationManager - Attempt failed (Received fatal alert: handshake_failure)... trying again 2012-09-28 21:03:40,001 ERROR javapns.notification.PushNotificationManager.sendNotification:426 - Attempt to send Notification failed and beyond the maximum number of attempts itted 45784 [Thread-36] ERROR javapns.notification.PushNotificationManager - Attempt to send Notification failed and beyond the maximum number of attempts permitted 2012-09-28 21:03:40,005 ERROR javapns.notification.PushNotificationManager.sendNotification:429 - Delivery error javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:174) at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:136) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1806) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:986) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1170) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:637) at com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:89) at java.io.OutputStream.write(OutputStream.java:58) at javapns.notification.PushNotificationManager.sendNotification(PushNotificationManager.java:402) at javapns.notification.PushNotificationManager.sendNotification(PushNotificationManager.java:350) at javapns.notification.PushNotificationManager.sendNotification(PushNotificationManager.java:320) at javapns.Push.sendPayload(Push.java:177) at javapns.Push.alert(Push.java:47) at com.disco.api.service.PushNotificationServiceImpl.test(PushNotificationServiceImpl.java:44) at com.disco.api.action.ViewUserAction$1.run(ViewUserAction.java:28) 45788 [Thread-36] ERROR javapns.notification.PushNotificationManager - Delivery error javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:174) at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:136) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1806) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:986) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1170) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:637) at com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:89) at java.io.OutputStream.write(OutputStream.java:58) at javapns.notification.PushNotificationManager.sendNotification(PushNotificationManager.java:402) at javapns.notification.PushNotificationManager.sendNotification(PushNotificationManager.java:350) at javapns.notification.PushNotificationManager.sendNotification(PushNotificationManager.java:320) at javapns.Push.sendPayload(Push.java:177) at javapns.Push.alert(Push.java:47) at com.disco.api.service.PushNotificationServiceImpl.test(PushNotificationServiceImpl.java:44) at com.disco.api.action.ViewUserAction$1.run(ViewUserAction.java:28) 2012-09-28 21:03:40,011 ERROR javapns.notification.PushNotificationManager.sendNotification:450 - Delivery error: javax.net.ssl.SSLHandshakeException: Received fatal alert: ha ke_failure 45794 [Thread-36] ERROR javapns.notification.PushNotificationManager - Delivery error: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure

Original issue: http://code.google.com/p/javapns/issues/detail?id=147

mwkirk commented 11 years ago

From sype...@gmail.com on September 28, 2012 17:38:51 Is there a proxy or a firewall in front of your server that could be interfering with the connection?

What happens if you run JavaPNS from the command line?

Could you please provide the full log output from JavaPNS, not just the exceptions part?

Could you also try version 2.3 Beta, which is in the trunk?

Thank you!

mwkirk commented 11 years ago

From fongyat...@gmail.com on September 30, 2012 07:34:29 I am a new iOS developer and have the same issue before. And this may be the same issue you facing.

I finally find the problem is due to the p12 certificate. We should not use the private key p12 file, instead we should generate a p12 from your private key and the cert download from Apple.

Please execute the following OpenSSL command to get the correct p12 file: developer_identity.cer <= download from Apple mykey.p12 <= Your private key

openssl x509 -in developer_identity.cer -inform DER -out developer_identity.pem -outform PEM openssl pkcs12 -nocerts -in mykey.p12 -out mykey.pem openssl pkcs12 -export -inkey mykey.pem -in developer_identity.pem -out iphone_dev.p12

After that, you should use iphone_dev.p12 to communicate with apple server.

mwkirk commented 11 years ago

From mahendr...@gmail.com on October 04, 2012 07:11:48 yes you are correct I was doing same mistake. I have corrected the .p12 file and its working fine. Thanks

mwkirk commented 11 years ago

From sype...@gmail.com on October 05, 2012 02:52:21 Closing issue report. Thank you.