We had a previously working installation on an Ubuntu 12.04 server in AWS. Recently our certificate expired so we regenerated the cert and installed it. Now we are getting the above error when using this cert on our production servers. We CAN use this same certificate, code and installation on a windows server just fine (no errors and notifications are sent). I have tried various combinations of installing the Apple intermediate certificates into the java 7 cacerts file with no luck. The stack trace is:
2014-02-08 19:07:39 T47 SEVERE
javax.net.ssl.SSLHandshakeException: Received fatal alert: unknown_ca
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.writeRecord(SSLSocketImpl.java:702)
at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:122)
at java.io.OutputStream.write(OutputStream.java:75)
at javapns.notification.PushNotificationManager.sendNotification(PushNotificationManager.java:402)
at javapns.notification.PushNotificationManager.sendNotification(PushNotificationManager.java:350)
at javapns.notification.PushNotificationManager.sendNotification(PushNotificationManager.java:320)
at javapns.Push.sendPayload(Push.java:177)
at javapns.Push.payload(Push.java:149)
at com.dotjava.eps.message.implementation.ss10_6.SendNotificationTask.call(SendNotificationTask.java:63)
We are using JavaPNS 2.2 with OpenJDK 7u51 64 bit.
The relevant code is:
n = (APNSNotification) session.load(APNSNotification.class, this.notification.getNotificationId(), LockOptions.UPGRADE);
if ( n.getApnsToken().length() != 64 ) {
updateNotification( n, NotificationStatus.Ignored );
} else {
Payload payload = PushNotificationPayload.alert(n.getMessage());
if ( n.getPayload() != null ) {
JSONObject json = new JSONObject(n.getPayload());
payload.getPayload().put("eps", json);
}
PushedNotifications results = Push.payload(payload, this.keystore, this.pwd, !this.staging, n.getApnsToken());
PushedNotification result = results.get(0);
if ( !result.isSuccessful() ) {
Exception ex = result.getException();
Log.error(ex);
updateNotification(n, NotificationStatus.Error);
} else {
updateNotification(n, NotificationStatus.Completed);
Log.note("Notification "+n.getNotificationId()+" sent to device token "+n.getApnsToken()+ " with message "+n.getMessage());
}
}
We had a previously working installation on an Ubuntu 12.04 server in AWS. Recently our certificate expired so we regenerated the cert and installed it. Now we are getting the above error when using this cert on our production servers. We CAN use this same certificate, code and installation on a windows server just fine (no errors and notifications are sent). I have tried various combinations of installing the Apple intermediate certificates into the java 7 cacerts file with no luck. The stack trace is:
2014-02-08 19:07:39 T47 SEVERE javax.net.ssl.SSLHandshakeException: Received fatal alert: unknown_ca 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.writeRecord(SSLSocketImpl.java:702) at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:122) at java.io.OutputStream.write(OutputStream.java:75) at javapns.notification.PushNotificationManager.sendNotification(PushNotificationManager.java:402) at javapns.notification.PushNotificationManager.sendNotification(PushNotificationManager.java:350) at javapns.notification.PushNotificationManager.sendNotification(PushNotificationManager.java:320) at javapns.Push.sendPayload(Push.java:177) at javapns.Push.payload(Push.java:149) at com.dotjava.eps.message.implementation.ss10_6.SendNotificationTask.call(SendNotificationTask.java:63)
We are using JavaPNS 2.2 with OpenJDK 7u51 64 bit.
The relevant code is: