收到致命警报:handshake_failure

Tit*_*eul 3 java liferay push-notification

我正在尝试使用liferay中的javapns库向我的设备发送推送通知.这是代码:

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();
        }

    }
Run Code Online (Sandbox Code Playgroud)

调用pushNotification时出现此错误:

ERROR [PushNotificationManager:450] Delivery error: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
Run Code Online (Sandbox Code Playgroud)

我用谷歌搜索但找不到任何解决方案.

有谁知道如何解决这个问题?

Mar*_*nto 9

javax.net.ssl.SSLHandshakeException异常通常是抛出当你试图连接到服务器不从授权的CA有效证书

简而言之,您尝试连接的服务器很可能使用自签名证书,您必须在Java代码中适应这一点.这涉及创建自定义KeyStore等.有关完整的实现详细信息,请参阅 Stack Overflow答案.