【问题标题】:javapns handling exception: javax.net.ssl.SSLException: Received fatal alert: internal_errorjavapns 处理异常:javax.net.ssl.SSLException:收到致命警报:internal_error
【发布时间】:2017-08-08 07:10:29
【问题描述】:

我正在尝试使用 javapns 向 IOS 发送推送通知。代码中正确提及了 keystore(P12) 文件的路径及其密码。

List < PushedNotification > NOTIFICATIONS = Push.payload(payload, "/home/sunil/Downloads/pushCertCurrent.p12", "password", false, "7964b31ec8b8a194f8c6b84924088d7b29bd98ecc28162e771f623d5ef0a39b6");

但是在向上面代码中最后一个参数提到的设备令牌的设备发送通知时,我收到 javax.net.ssl.SSLException: Received fatal alert: internal_error

我已附加带有 -Djavax.net.debug=all 参数的调试器并在控制台中获取以下日志。

这是我得到的日志的一部分。

main, READ: TLSv1.2 Alert, length = 2
main, RECV TLSv1.2 ALERT:  fatal, internal_error
%% Invalidated:  [Session-1, SSL_RSA_WITH_3DES_EDE_CBC_SHA]
main, called closeSocket()
main, handling exception: javax.net.ssl.SSLException: Received fatal alert: internal_error
javax.net.ssl.SSLException: Received fatal alert: internal_error
    at sun.security.ssl.Alerts.getSSLException(Alerts.java:208)
    at sun.security.ssl.Alerts.getSSLException(Alerts.java:154)
    at sun.security.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:2023)
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1125)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375)
    at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:747)
    at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:123)
    at java.io.OutputStream.write(OutputStream.java:75)
    at javapns.notification.PushNotificationManager.sendNotification(PushNotificationManager.java:427)
    at javapns.notification.PushNotificationManager.sendNotification(PushNotificationManager.java:366)
    at javapns.notification.PushNotificationManager.sendNotification(PushNotificationManager.java:336)
    at javapns.Push.sendPayload(Push.java:178)
    at javapns.Push.payload(Push.java:149)
    at com.icube.apns.TestPushNotificationApp.main(TestPushNotificationApp.java:35)
17063 [main] INFO javapns.notification.PushNotificationManager  - Attempt failed (Received fatal alert: internal_error)... trying again
main, called close()
main, called closeInternal(true)
18495 [main] DEBUG javapns.communication.ConnectionToAppleServer  - Creating SSLSocket to gateway.sandbox.push.apple.com:2195
Allow unsafe renegotiation: false
Allow legacy hello messages: true
Is initial handshake: true
Is secure renegotiation: false
main, setSoTimeout(30000) called
26600 [main] DEBUG javapns.notification.PushNotificationManager  - Reading responses
main, setSoTimeout(5000) called

请帮助我找出我做错了什么,这是我的问题还是苹果的问题。

【问题讨论】:

    标签: java apple-push-notifications javapns


    【解决方案1】:

    我发现了问题,这不是我的代码的问题。我刚刚重新生成了苹果的证书/密钥库(P12),它开始工作了,生成密钥库可能有问题。

    【讨论】:

    • 嗨@Sunil,您在生成p12 时有没有特别注意?我面临着完全相同的麻烦。我遵循“标准”程序,即在 Apple Developer Centre 中生成证书,下载它,然后使用 Keychain 应用程序中的私钥导出它。是这样的吗?
    猜你喜欢
    • 2013-05-08
    • 2017-03-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-11-22
    • 2016-06-12
    • 1970-01-01
    • 2014-10-22
    相关资源
    最近更新 更多