gpt4 book ai didi

tomcat - Apns push 在主函数中运行正常,但是在tomcat 中运行时出错?

转载 作者:行者123 更新时间:2023-11-28 23:41:02 26 4
gpt4 key购买 nike

详情

我使用 notnoop java-apns 推送 mdm 消息,我在主函数中尝试推送消息没问题! 但是添加到 spring mvm run in jetty/tomcat web context throws javax.net.ssl.SSLHandshakeException: Received fatal警报:握手失败!帮助我。

使用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)

最佳答案

错误可能是由于您的tomcat 服务器无法访问p12 文件。要么您忘记将 p12 文件上传到您的服务器,要么它正在与您放入的文件夹不同的文件夹中查找它。

.getSystemResourceAsStream("mdm_push.p12"),"123456")

您可能应该在该调用中指定 p12 文件的路径。

关于tomcat - Apns push 在主函数中运行正常,但是在tomcat 中运行时出错?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19627880/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com