详情
我使用notnoop java-apns 推送mdm消息,我在主功能中尝试了推送消息可以!但是添加到在jetty / tomcat Web上下文中运行的spring mvm中会抛出javax.net.ssl.SSLHandshakeException:收到致命警报:handshake_failure!帮我。
使用Spring MVC方法
ModelAttribute
RequestMapping("/deviceinfo")
public String pushCommand(HttpServletRequest request)
{
String id = request.getParameter("id");
Device device = deviceManager.get(new Long(id));
log.debug(device);
log.debug(device.getToken());
ApnsService service = APNS.newService().withCert( ClassLoader
.getSystemResourceAsStream("mdm_push.p12"),"123456")
.withProductionDestination().build();
String mdmPayload = APNS.newPayload().mdm(device.getToken().getPushMagic()).build();
service.push(device.getToken().getToken(), mdmPayload);
log.warn("mdmDeviceInfoCommand");
return "device form";
}
错误信息:
INFO [Thread-19] ApnsConnectionImpl.run(170) | Exception while waiting for error code
javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
at sun.security.ssl.Alerts.getSSLException(Alerts.java:154)
at sun.security.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1959)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1077)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1312)
at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:882)
at sun.security.ssl.AppInputStream.read(AppInputStream.java:102)
at java.io.InputStream.read(InputStream.java:101)
at >com.notnoop.apns.internal.ApnsConnectionImpl$1MonitoringThread.run(ApnsConnectionImpl.java:114)
DEBUG [qtp297885139-65] ApnsConnectionImpl.socket(218) | Made a new connection to APNS
INFO [Thread-20] ApnsConnectionImpl.run(170) | Exception while waiting for error code
javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
at sun.security.ssl.Alerts.getSSLException(Alerts.java:154)
at sun.security.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1959)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1077)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1312)
at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:882)
at sun.security.ssl.AppInputStream.read(AppInputStream.java:102)
at java.io.InputStream.read(InputStream.java:101)
at >com.notnoop.apns.internal.ApnsConnectionImpl$1MonitoringThread.run(ApnsConnectionImpl.java:114)
INFO [qtp297885139-65] ApnsConnectionImpl.sendMessage(264) | Failed to send message >Message(Id=1; Token=07BE34F5A71A; Payload={"mdm":"E101CB39-697A-4883-B303-67713DEE836E"})... >trying again after delay
javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
at sun.security.ssl.Alerts.getSSLException(Alerts.java:154)
at sun.security.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1959)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1077)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1312)
at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:882)
at sun.security.ssl.AppInputStream.read(AppInputStream.java:102)
at java.io.InputStream.read(InputStream.java:101)
at >com.notnoop.apns.internal.ApnsConnectionImpl$1MonitoringThread.run(ApnsConnectionImpl.java:114)
最佳答案
@artbristol的建议将向您显示根本原因。
-Djavax.net.debug=ssl
一些例子:
bad/missing ciphers
bad/missing keystore information