收到致命警报:handshake_failure [英] Received fatal alert: handshake_failure
问题描述
我正在尝试使用 liferay 中的 javapns 库将推送通知发送到我的设备.这是代码:
I'm trying to send push notifications to my device using javapns library in liferay. Here's the code:
private void pushNotification(ActionRequest actionRequest,
ActionResponse actionResponse) {
try {
System.out.println("Push");
Push.alert("Hello World!", "ck.p12", "PASSPHRASE", false, "TOKEN");
} catch (CommunicationException e) {
System.out.println("CommunicationException");
e.printStackTrace();
} catch (KeystoreException e) {
System.out.println("KeystoreException");
e.printStackTrace();
}
}
调用pushNotification时出现此错误:
I'm getting this error when the pushNotification is called:
ERROR [PushNotificationManager:450] Delivery error: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
我已经对其进行了搜索,但找不到任何解决方案.
I've googled it but couldn't find any solution.
有人知道如何解决这个问题吗?
Does anyone know how to solve this problem?
推荐答案
当您尝试连接的服务器没有来自授权CA的有效证书时,通常会引发javax.net.ssl.SSLHandshakeException
异常.
The javax.net.ssl.SSLHandshakeException
exception is usually thrown when the server you're trying to connect to does not have a valid certificate from an authorized CA.
简单地说,您尝试连接的服务器很可能使用自签名证书,并且您必须在Java代码中容纳该证书.这涉及创建自定义KeyStore
等.有关完整的实现详细信息,请参见此堆栈溢出答案.
Put simply, the server you're attempting to connect to is most likely using a self-signed certificate and you have to accomodate for that in your Java code. This involves creating a custom KeyStore
, etc. See this Stack Overflow answer for full implementation details.
这篇关于收到致命警报:handshake_failure的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!