2

细节

我使用 notnoop java-apns push mdm message,我在main函数中尝试push message没问题!但是添加到 spring mvm 在 jetty/tomcat web 上下文中运行会抛出 javax.net.ssl.SSLHandshakeException: Received fatal alert: 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)
4

1 回答 1

1

@artbristol的建议会告诉你根本原因是什么。

-Djavax.net.debug=ssl

一些例子:

于 2013-10-30T18:45:41.853 回答