java.io.EOFException: SSL peer shut down incorrectly -
i have following code:
package daoimp; import java.util.list; import javapns.push; import javapns.communication.exceptions.keystoreexception; import javapns.notification.pushednotification; import javapns.notification.responsepacket; import org.json.jsonexception; import com.sun.jmx.snmp.daemon.communicationexception; public class notification { public static void main(string args[]) { try { new notification().sendmessagetoapn(); } catch (communicationexception | keystoreexception | jsonexception | javapns.communication.exceptions.communicationexception e) { e.printstacktrace(); } } public void sendmessagetoapn() throws communicationexception, keystoreexception, jsonexception, javapns.communication.exceptions.communicationexception { string regid1 = "6f9d340ab4d0f81206f7d8c1ab7b8994d90d139e0d1d2b99999b02887e60d54f"; list<pushednotification> notifications = push.alert("hello","c:/program files (x86)/java/jdk1.7.0_21/jre/lib/security/gameover.p12", "gameover", false, regid1); (pushednotification notification : notifications) { if (notification.issuccessful()) { system.out.println("push notification sent to: " + notification.getdevice().gettoken()); } else { string invalidtoken = notification.getdevice().gettoken(); system.err.println("invalid token " + invalidtoken); system.out.println(" problem was"); exception theproblem = notification.getexception(); theproblem.printstacktrace(); responsepacket theerrorresponse = notification.getresponse(); if (theerrorresponse != null) { system.out.println(theerrorresponse.getmessage()); } } } } } when run code, following exception message: handshake ssl failed connection remote host failed during handshake.
log4j:warn no appenders found logger (javapns.notification.payload). log4j:warn please initialize log4j system properly. invalid token 6f9d340ab4d0f81206f7d8c1ab7b6774d90d139e0d1d2b58599b02887e60d54f problem javax.net.ssl.sslhandshakeexception: remote host closed connection during handshake @ sun.security.ssl.sslsocketimpl.readrecord(unknown source) @ sun.security.ssl.sslsocketimpl.performinitialhandshake(unknown source) @ sun.security.ssl.sslsocketimpl.writerecord(unknown source) @ sun.security.ssl.appoutputstream.write(unknown source) @ java.io.outputstream.write(unknown source) @ javapns.notification.pushnotificationmanager.sendnotification(pushnotificationmanager.java:402) @ javapns.notification.pushnotificationmanager.sendnotification(pushnotificationmanager.java:350) @ javapns.notification.pushnotificationmanager.sendnotification(pushnotificationmanager.java:320) @ javapns.push.sendpayload(push.java:177) @ javapns.push.alert(push.java:47) @ daoimp.notification.sendmessagetoapn(notification.java:27) @ daoimp.notification.main(notification.java:16) caused by: java.io.eofexception: ssl peer shut down incorrectly @ sun.security.ssl.inputrecord.read(unknown source) ... 12 more i don't know why i'm getting message.
i believe missing certificates.
you can generate them using installcerts app. (http://miteff.com/install-cert)
or http://opentox.ntua.gr/blog/77-ssl-certificates
once certificate, need put under security directory within jdk home, example:
c:\program files\java\jdk1.6.0_45\jre\lib\security
hope resolves issue
Comments
Post a Comment