Skip to content
This repository

Feedback Service fails with Java 7 #54

Closed
revetkn opened this Issue · 5 comments

5 participants

Mark Allen Mahmood Ali Adrien Ferré esromneb froh42
Mark Allen

It works perfectly fine with Java 6, but using Java 7 causes "certificate_unknown" to be raised during the handshake. The error occurred on Oracle's official JDK 7 on Ubuntu 11.04 x64.

Here's the code:

ApnService apnsService = newService().withCert(loadFile("/push-notification-cert.p12"), "PASSWORD").withSandboxDestination().build();

for (Entry<String, Date> entry : apnsService.getInactiveDevices().entrySet()) {
  ...
}

Here's the stack trace:

20110906.182802.770 ERROR ApnsFeedbackConnection:84 - Couldn't get feedback connection
java.lang.RuntimeException: javax.net.ssl.SSLHandshakeException: Received fatal alert: certificate_unknown
    at com.notnoop.apns.internal.Utilities.parseFeedbackStreamRaw(Utilities.java:201)
    at com.notnoop.apns.internal.Utilities.parseFeedbackStream(Utilities.java:211)
    at com.notnoop.apns.internal.ApnsFeedbackConnection.getInactiveDevicesImpl(ApnsFeedbackConnection.java:105)
    at com.notnoop.apns.internal.ApnsFeedbackConnection.getInactiveDevices(ApnsFeedbackConnection.java:77)
    at com.notnoop.apns.internal.AbstractApnsService.getInactiveDevices(AbstractApnsService.java:132)
    at com.notnoop.apns.internal.ApnsServiceImpl.getInactiveDevices(ApnsServiceImpl.java:36)
    at com.myapp.backend.service.PushNotificationService.synchronizeWithFeedbackService(PushNotificationService.java:120)
    at com.myapp.backend.service.PushNotificationService.access$000(PushNotificationService.java:36)
    at com.myapp.backend.service.PushNotificationService$1$1.doInTransaction(PushNotificationService.java:67)
    at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
    at com.myapp.backend.service.PushNotificationService$1.run(PushNotificationService.java:65)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:351)
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:178)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
    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: javax.net.ssl.SSLHandshakeException: Received fatal alert: certificate_unknown
    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:1911)
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1027)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1262)
    at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:816)
    at sun.security.ssl.AppInputStream.read(AppInputStream.java:102)
    at sun.security.ssl.AppInputStream.read(AppInputStream.java:69)
    at java.io.DataInputStream.readInt(DataInputStream.java:387)
    at com.notnoop.apns.internal.Utilities.parseFeedbackStreamRaw(Utilities.java:192)
    ... 18 more
20110906.182803.081 WARN  PushNotificationService:72 - Feedback service poller failed to execute correctly.
java.lang.RuntimeException: javax.net.ssl.SSLHandshakeException: Received fatal alert: certificate_unknown
    at com.notnoop.apns.internal.Utilities.parseFeedbackStreamRaw(Utilities.java:201)
    at com.notnoop.apns.internal.Utilities.parseFeedbackStream(Utilities.java:211)
    at com.notnoop.apns.internal.ApnsFeedbackConnection.getInactiveDevicesImpl(ApnsFeedbackConnection.java:105)
    at com.notnoop.apns.internal.ApnsFeedbackConnection.getInactiveDevices(ApnsFeedbackConnection.java:77)
    at com.notnoop.apns.internal.AbstractApnsService.getInactiveDevices(AbstractApnsService.java:132)
    at com.notnoop.apns.internal.ApnsServiceImpl.getInactiveDevices(ApnsServiceImpl.java:36)
    at com.myapp.backend.service.PushNotificationService.synchronizeWithFeedbackService(PushNotificationService.java:120)
    at com.myapp.backend.service.PushNotificationService.access$000(PushNotificationService.java:36)
    at com.myapp.backend.service.PushNotificationService$1$1.doInTransaction(PushNotificationService.java:67)
    at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
    at com.myapp.backend.service.PushNotificationService$1.run(PushNotificationService.java:65)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:351)
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:178)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
    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: javax.net.ssl.SSLHandshakeException: Received fatal alert: certificate_unknown
    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:1911)
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1027)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1262)
    at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:816)
    at sun.security.ssl.AppInputStream.read(AppInputStream.java:102)
    at sun.security.ssl.AppInputStream.read(AppInputStream.java:69)
    at java.io.DataInputStream.readInt(DataInputStream.java:387)
    at com.notnoop.apns.internal.Utilities.parseFeedbackStreamRaw(Utilities.java:192)
    ... 18 more
Mahmood Ali
Owner

Greetings,

Did you install the certificate with Java 7? For each install of Java, you'd need to follow the instructions at https://github.com/notnoop/java-apns/wiki .

Mark Allen

I did try that for Java 7, it appears to have no effect. And FWIW, using a totally clean install of the latest version of Java 6 (27) does not require this be done. I unzipped Java 6 download from Oracle and pointed JAVA_HOME to it and everything worked immediately, no copying of jssecacerts necessary.

Adrien Ferré

Hi

Can you fix the dead link on your wiki page please (InstallCert.java)?

esromneb

I have been getting a similar error which is shown below. The problem for me was that everything was OK on my windows box but under Ubuntu it wasn't working. The problem was that Java on my windows was "build 1.7.0_01-b08" and Linux was "build 1.6.0_29-b11".

I tried everything, including the link shown above, but nothing would work under 1.6. I even added the CA to my jre/lib/security/cacerts file. Nothing was working at all! After updating java on my Ubuntu Linux to "build 1.7.0_04-b20" everything works fine! Thanks for an awesome jar :)


[2012-05-09 01:47:06,124] 40435 INFO [catalina-exec-4] com.dailybread.dao.GeneralNotificationsDaoImpl - push exception: com.notnoop.exceptions.NetworkIOException: javax.net.ssl.SSLHandshakeException: Received fatal alert: certificate_unknown
com.notnoop.exceptions.NetworkIOException: javax.net.ssl.SSLHandshakeException: Received fatal alert: certificate_unknown
at com.notnoop.apns.internal.Utilities.wrapAndThrowAsRuntimeException(Utilities.java:268)
at com.notnoop.apns.internal.ApnsConnectionImpl.sendMessage(ApnsConnectionImpl.java:173)
at com.notnoop.apns.internal.ApnsServiceImpl.push(ApnsServiceImpl.java:46)
at com.notnoop.apns.internal.AbstractApnsService.push(AbstractApnsService.java:52)
at com.notnoop.apns.internal.ApnsServiceImpl.push(ApnsServiceImpl.java:36)
at com.dailybread.dao.push.PushDaoImpl.sendPushWithPayloadToUser(PushDaoImpl.java:184)

Caused by: javax.net.ssl.SSLHandshakeException: Received fatal alert: certificate_unknown
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:174)
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:136)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1806)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:986)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1170)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:637)
at com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:88)
at java.io.OutputStream.write(OutputStream.java:58)
at com.notnoop.apns.internal.ApnsConnectionImpl.sendMessage(ApnsConnectionImpl.java:161)

Mark Kirk mwkirk referenced this issue in mwkirk/javapns
Closed

certificate_unknown #122

froh42 froh42 closed this
froh42
Collaborator

Last comment:

After updating java on my Ubuntu Linux to "build 1.7.0_04-b20" everything works fine!

--> Close issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.