com.notnoop.exceptions.NetworkIOException:javax.net.ssl.SSLException:收到致命警报:internal_error

com.notnoop.exceptions.NetworkIOException: javax.net.ssl.SSLException: Received fatal alert: internal_error

我有一个与使用 spring 框架的 APNS 库相关的问题。

我想做的是向特定设备发送推送通知,如果它在数据库中有待处理的消息,我使用的是已经证明有效的开发证书,这是我的代码块抛出异常

ApnsService service = APNS.newService()
                                .withCert(messageDevice.getMessage().getMessageWebappCert(),"superDificultPasswordYouWillNeverGuessIn1Life")
                                .withProductionDestination()
                                .build();
service.testConnection();

这是我的问题,因为我的代码抛出了这个 SSL 异常:

com.notnoop.exceptions.NetworkIOException:javax.net.ssl.SSLException:收到致命警报:internal_error

at com.notnoop.apns.internal.Utilities.wrapAndThrowAsRuntimeException(Utilities.java:277)
at com.notnoop.apns.internal.ApnsConnectionImpl.sendMessage(ApnsConnectionImpl.java:257)
at com.notnoop.apns.internal.ApnsConnectionImpl.sendMessage(ApnsConnectionImpl.java:230)
at com.notnoop.apns.internal.ApnsConnectionImpl.testConnection(ApnsConnectionImpl.java:294)
at com.notnoop.apns.internal.ApnsServiceImpl.testConnection(ApnsServiceImpl.java:57)
at com.ehecatl.noordwijk.util.MessageTask.sendMessagesSubject(MessageTask.java:124)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:65)
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access1(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: javax.net.ssl.SSLException: Received fatal alert: internal_error
at sun.security.ssl.Alerts.getSSLException(Alerts.java:208)
at sun.security.ssl.Alerts.getSSLException(Alerts.java:154)
at sun.security.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:2023)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1125)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375)
at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:747)
at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:123)
at java.io.OutputStream.write(OutputStream.java:75)
at com.notnoop.apns.internal.ApnsConnectionImpl.sendMessage(ApnsConnectionImpl.java:240)
... 17 more

真心希望你能帮帮我

我在发送生产通知时遇到了完全相同的问题。 原来我使用的是 我不久前撤销的证书。

我已更改为新证书,现在可以使用了。

Apple 中止了 SSL 握手,因为它无法识别我正在使用的客户端证书。

起初我以为是证书问题,但问题出在我使用依赖项的方式上。我需要做的是检查我的 pom.xml 文件并检查 apns 依赖项。它必须像 here 中那样出现。如果不是,可以在 Scope 组合框中的属性 window 中进行更改 enter image description here