problems using pushy 0.5 and netty-tcnative

588 views
Skip to first unread message

onroad

unread,
Jan 26, 2016, 4:35:16 AM1/26/16
to pushy
I used pushy 0.5 and netty-tcnative, I have 2 problems now.
THE FIRST :
I test pushy 0.5 on Mac(osx Yosemite 10.10.4).

My openssl version:

OpenSSL 1.0.2d 9 Jul 2015


My java version:

java version "1.7.0_76"


pom.xml like:

<dependency>

          <groupId>com.relayrides</groupId>

          <artifactId>pushy</artifactId>

          <version>0.5</version>

      </dependency>

      <dependency>

          <groupId>io.netty</groupId>

          <artifactId>netty-tcnative</artifactId>

          <version>1.1.33.Fork9</version>

          <classifier>osx-x86_64</classifier>

      </dependency>


I am sure p12 and password are right because it work on pushy 0.4.3 on my server(java version "1.6.0_35")
Exception Message:
2016-01-26 16:56:07.764  INFO (ApnsClient.java:495) - Failed to connect.
java.lang.IllegalStateException: Channel closed before HTTP/2 preface completed.
at com.relayrides.pushy.apns.ApnsClient$3.operationComplete(ApnsClient.java:454)
at com.relayrides.pushy.apns.ApnsClient$3.operationComplete(ApnsClient.java:448)
at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:680)
at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:567)
at io.netty.util.concurrent.DefaultPromise.trySuccess(DefaultPromise.java:406)
at io.netty.channel.DefaultChannelPromise.trySuccess(DefaultChannelPromise.java:82)
at io.netty.channel.AbstractChannel$CloseFuture.setClosed(AbstractChannel.java:1021)
at io.netty.channel.AbstractChannel$AbstractUnsafe.doClose0(AbstractChannel.java:665)
at io.netty.channel.AbstractChannel$AbstractUnsafe.close(AbstractChannel.java:643)
at io.netty.channel.AbstractChannel$AbstractUnsafe.close(AbstractChannel.java:587)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.closeOnRead(AbstractNioByteChannel.java:70)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:133)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:510)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:467)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:381)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:353)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:742)
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137)
at java.lang.Thread.run(Thread.java:745)
2016-01-26 16:56:07.771  WARN (Slf4JLogger.java:146) - [id: 0x559ec315, 0.0.0.0/0.0.0.0:61553 :> api.push.apple.com/17.143.164.79:443] TLS handshake failed:
java.nio.channels.ClosedChannelException




The Second Problem

<dependency>

          <groupId>io.netty</groupId>

          <artifactId>netty-tcnative</artifactId>

          <version>1.1.33.Fork9</version>

          <classifier>linux-x86_64</classifier>

      </dependency>


The same code on my server

java version :
java version "1.6.0_35"
and
jdk was updated by Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files 6

openssl version:
OpenSSL 1.0.1e-fips 11 Feb 2013


Exception Message:

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/tomcat/jni/SSL : Unsupported major.minor version 51.0

at java.lang.ClassLoader.defineClass1(Native Method)

at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)

at java.lang.ClassLoader.defineClass(ClassLoader.java:615)

at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)

at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)

at java.net.URLClassLoader.access$000(URLClassLoader.java:58)

at java.net.URLClassLoader$1.run(URLClassLoader.java:197)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(URLClassLoader.java:190)

at java.lang.ClassLoader.loadClass(ClassLoader.java:306)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)

at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Class.java:247)

at io.netty.handler.ssl.OpenSsl.<clinit>(OpenSsl.java:47)

at com.relayrides.pushy.apns.ApnsClient.getBaseSslContextBuilder(ApnsClient.java:292)

at com.relayrides.pushy.apns.ApnsClient.getSslContextWithCertificateAndPrivateKey(ApnsClient.java:285)

at com.relayrides.pushy.apns.ApnsClient.getSslContextWithP12File(ApnsClient.java:281)

at com.relayrides.pushy.apns.ApnsClient.<init>(ApnsClient.java:198)

at com.relayrides.pushy.apns.ApnsClient.<init>(ApnsClient.java:177)

at App.connect(App.java:23)

at App.main(App.java:84)



j...@turo.com

unread,
Jan 26, 2016, 9:01:39 AM1/26/16
to pushy
I'm not sure what's going wrong on the client side. Could you please make logging more verbose (maybe try DEBUG or TRACE as a log level?) and see if anything comes up in the logs?

As for the server side, it appears that I was mistaken and netty-tcnative doesn't actually support Java 6. I'll update the system requirements accordingly, but I'm afraid there may not be much we can do to make Pushy 0.5 work with Java 6.

Cheers!

-Jon

onroad

unread,
Jan 26, 2016, 10:00:42 PM1/26/16
to pushy
Thank you for your reply.
Can you give me a simple demo using pushy 0.5?
and some system configs .For example:
java version , pom.xml , openssl version

Looking forward to your reply.

在 2016年1月26日星期二 UTC+8下午10:01:39,j...@turo.com写道:

onroad

unread,
Jan 27, 2016, 3:59:26 AM1/27/16
to pushy
I test push 0.5.1 today.
I found that the old p12 on product not support new apns , new p12 and old p12 on develop is work . 
This is the cause of the problem “java.lang.IllegalStateException: Channel closed before HTTP/2 preface completed.

在 2016年1月26日星期二 UTC+8下午10:01:39,j...@turo.com写道:
I'm not sure what's going wrong on the client side. Could you please make logging more verbose (maybe try DEBUG or TRACE as a log level?) and see if anything comes up in the logs?

j...@turo.com

unread,
Jan 28, 2016, 10:13:37 AM1/28/16
to pushy
> I found that the old p12 on product not support new apns , new p12 and old p12 on develop is work . 

Sorry—can you elaborate a bit on that point? Where did your old p12 come from, and what steps did you need to take to get a p12 that worked as expected?

Thanks!

-Jon

Vaidotas Baužys

unread,
Feb 8, 2016, 12:27:09 AM2/8/16
to pushy
I got similar error and I use jetty ALPN library. After trying variuos things I find out that culprit was openjdk in linux. Installing oracle jre version, solved this issue.
Reply all
Reply to author
Forward
0 new messages