Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/performance/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
GCM服务器推送失败,SSLException(Java)_Java_Ssl_Bouncycastle_Google Cloud Messaging - Fatal编程技术网

GCM服务器推送失败,SSLException(Java)

GCM服务器推送失败,SSLException(Java),java,ssl,bouncycastle,google-cloud-messaging,Java,Ssl,Bouncycastle,Google Cloud Messaging,当我向谷歌云信息中心发送新推送通知时,有时会出现问题。我正在使用谷歌提供的图书馆。我使用Tomcat 7.0.35和bouncycastle 1.46。错误只是偶尔发生,我无法预测何时发生。这是stacktrace: 09:05:24 [pool-18-thread-1] Sender - IOException posting to GCM javax.net.ssl.SSLException: java.lang.RuntimeException: Could not generate se

当我向谷歌云信息中心发送新推送通知时,有时会出现问题。我正在使用谷歌提供的图书馆。我使用Tomcat 7.0.35和bouncycastle 1.46。错误只是偶尔发生,我无法预测何时发生。这是stacktrace:

09:05:24 [pool-18-thread-1] Sender - IOException posting to GCM
javax.net.ssl.SSLException: java.lang.RuntimeException: Could not generate secret
        at sun.security.ssl.Alerts.getSSLException(Alerts.java:208)
        at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1868)
        at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1826)
        at sun.security.ssl.SSLSocketImpl.handleException(SSLSocketImpl.java:1809)
        at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1328)
        at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1305)
        at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:515)
        at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
        at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1090)
        at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:250)
        at com.google.android.gcm.server.Sender.post(Sender.java:582)
        at com.google.android.gcm.server.Sender.sendNoRetry(Sender.java:420)
        at com.test.push.service.impl.PushServiceImpl$2.call(PushServiceImpl.java:606)
        at com.test.push.service.impl.PushServiceImpl$2.call(PushServiceImpl.java:599)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.RuntimeException: Could not generate secret
        at sun.security.ssl.ECDHCrypt.getAgreedSecret(ECDHCrypt.java:99)
        at sun.security.ssl.ClientHandshaker.serverHelloDone(ClientHandshaker.java:930)
        at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:282)
        at sun.security.ssl.Handshaker.processLoop(Handshaker.java:868)
        at sun.security.ssl.Handshaker.process_record(Handshaker.java:804)
        at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:998)
        at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1294)
        at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1321)
        ... 14 more
Caused by: java.security.InvalidKeyException: ECDH key agreement requires ECPublicKey for doPhase
        at org.bouncycastle.jce.provider.asymmetric.ec.KeyAgreement.engineDoPhase(Unknown Source)
        at javax.crypto.KeyAgreement.doPhase(KeyAgreement.java:551)
        at sun.security.ssl.ECDHCrypt.getAgreedSecret(ECDHCrypt.java:96)
        ... 21 more

有人经历过类似的事情吗?

我让应用程序运行在2个tomcats 7.0.x和Java 1.7上。问题只发生在其中一个上,通过更改为Java1.6解决了