Mindbowser / javapns

Automatically exported from code.google.com/p/javapns
0 stars 0 forks source link

javapns 2.0 Beta 4 - Received fatal alert: handshake_failure #67

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
=========================
1. Method Code

public String hello(String my_iPhone_ID){
        System.out.println( "Setting up Push notification" );
        String result = null;
        try {
            Push.alert("Hello World!", certificate, password, false, my_iPhone_ID);
            result = "Done!";
        }
        catch (Exception e) {
            System.out.println("Message Sending Error");
            e.printStackTrace();
        }
        return result;
    }
=========================
2. String used as an argument is a valid String
=========================
3.
=========================
What is the expected output?
Connected to the Apple Push Notification Service and a Message that confirms 
everything was OK.
=========================
What do you see instead?

Error pushing notification(s):
javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
    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:1720)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:954)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1138)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:632)
    at com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:59)
    at java.io.OutputStream.write(OutputStream.java:58)
    at javapns.notification.PushNotificationManager.sendNotification(PushNotificationManager.java:254)
    at javapns.notification.PushNotificationManager.sendNotification(PushNotificationManager.java:192)
    at javapns.Push.payload(Push.java:117)
    at javapns.Push.alert(Push.java:31)
    at com.cystelcom.apnstest.main.MyPushImpl.hello(MyPushImpl.java:31)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:173)
    at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:89)
    at org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:61)
    at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:75)
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:106)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
    at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
    at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:206)
    at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:218)
    at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:200)
    at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:114)
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:184)
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:107)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:163)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    at java.lang.Thread.run(Thread.java:662)

=========================
What version of the product are you using? On what operating system?

javapns_2.0_Beta_4.jar

=========================

Original issue reported on code.google.com by Christia...@gmail.com on 21 Sep 2011 at 10:35

GoogleCodeExporter commented 8 years ago
That is the only exception printed?  Are you certain that your keystore has 
been generated according to the documentation (see GetAPNSCertificate in wiki) 
for the SANDBOX server, and that your "certificate" property points to your 
keystore file?  Are you also sure that your keystore password is correct?

If you're sure your keystore and password are valid, more details would be 
required to understand what is going on during handshake.  Could you enable SSL 
debugging (see SSL Certificate issues in the Tips wiki page) and provide the 
full printout?  Thanks!

Original comment by sype...@gmail.com on 21 Sep 2011 at 11:28

GoogleCodeExporter commented 8 years ago
I think that I had problems with the certificate...
Maybe it got corrupted while I changed it from Mac to PC, because I am 
programming on PC.

Now I think it works, because I did not get a Notification on the phone.

Will the Beta become a final soon ?
My company does not want to use any Beta versions, although I am making test 
with this one.

Thank you very much for replying that fast.

Original comment by Christia...@gmail.com on 21 Sep 2011 at 11:38

GoogleCodeExporter commented 8 years ago
By the way, I have tried using the proper certificate with a wrong phone ID to 
check how the server behaved, but I have not received any response from the 
APNs server.

I think that is due to using normal notifications instead of enhanced 
notifications.
Will enhanced notifications solve the problem?
Where can I find the JavaDoc of the Javapns Beta so I can activate enhanced 
notifications ?

Thank you very much and have a nice day.

Original comment by Christia...@gmail.com on 21 Sep 2011 at 1:02

GoogleCodeExporter commented 8 years ago
As per your comment #2, I'm closing the issue as Invalid since it was a local 
certificate issue and not a library bug.

Regarding your question about the beta phase, it all depends on the feedback we 
receive from users.  If new issues are discovered, the beta phase will continue 
a bit longer.  If only positive feedback is received, we can move forward 
toward a final version.  Since Beta 4 is very recent, not much feedback has 
been received so far.

As for your other question about invalid tokens, the enhanced notification 
format will help detect malformed push messages, payloads, token format, etc.  
I'm not sure if the token is actually checked if it matches a known device, or 
if instead an invalid token will simply show up in the Feedback Service after a 
few failed attempts at pushing to that invalid token.  I would think that the 
second option is the one used by Apple.  I can't find any clear explanation of 
this in Apple's documentation, beside the simple list of error codes.  

At this time though, enhanced notifications are not fully supported...  see 
issue #47 for more details.

Finally, the javadoc is in SVN:  svn/  branches/ javapns2/ 
javapns_2.0_Beta_4_javadoc.jar

Original comment by sype...@gmail.com on 21 Sep 2011 at 10:38