Skip to content

Sending Push Notifications cause Socket Exception #59

Closed
srrnpartners opened this Issue Nov 9, 2011 · 3 comments

3 participants

@srrnpartners

Hey guys! Everytime I try and send a message after initializing APNS it triggers this exception? What kind of certification requirements do I need for notnoop to run correctly if it's a certification issue. Thank you for your time here is the stack trace.

Failed to send message com.notnoop.apns.EnhancedApnsNotification@249b70b0... trying again
javax.net.ssl.SSLException: Connection has been shutdown: javax.net.ssl.SSLException: java.net.SocketException: Connection closed by remote host
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.checkEOF(SSLSocketImpl.java:1293)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.checkWrite(SSLSocketImpl.java:1305)
at com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:43)
at java.io.OutputStream.write(OutputStream.java:58)
at com.notnoop.apns.internal.ApnsConnectionImpl.sendMessage(ApnsConnectionImpl.java:171)
at com.notnoop.apns.internal.ApnsServiceImpl.push(ApnsServiceImpl.java:46)
at com.notnoop.apns.internal.AbstractApnsService.push(AbstractApnsService.java:56)
at com.notnoop.apns.internal.ApnsServiceImpl.push(ApnsServiceImpl.java:36)
at com.notnoop.apns.internal.AbstractApnsService.push(AbstractApnsService.java:45)
at helpers.messaging.push.Client.push(Client.java:109)
at helpers.messaging.push.Client.push(Client.java:96)
at helpers.messaging.push.Client.push(Client.java:152)
at jobs.promise.ChatMessage.doJobWithResult(ChatMessage.java:59)
at jobs.promise.ChatMessage.doJobWithResult(ChatMessage.java:1)
at play.jobs.Job.call(Job.java:146)
at play.jobs.Job$1.call(Job.java:66)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)

@weitzj
weitzj commented Jan 18, 2012

Hi,

if you use a Developer Certificate, you have to use the sandbox destination
APNS.newService().withCert("PATH_TO_FILE", "PASSWORD").withSandboxDestination().build()

if you have a Release Certicicate, you have to use the production destination
APNS.newService().withCert("PATH_TO_FILE", "PASSWORD").withProductionDestination().build()

Greets,

Jan

@froh42
Collaborator
froh42 commented Nov 22, 2012

java-apns also might throw this error for messages sent right after a message that failed. (APNS server would close connection, message send fails because the socket is unusable. Only after a retry (buliding a new socket) the next message can be sent.
Fix in: froh42/java-apns@1911ee8

@froh42
Collaborator
froh42 commented May 21, 2014

Cleaning up, closing old issue.

Feel free to reopen if desired.

@froh42 froh42 closed this May 21, 2014
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.