Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AbstractMethodError when trying to connect to APNs Gaterway #246

Closed
dorheini opened this issue Feb 25, 2016 · 4 comments
Closed

AbstractMethodError when trying to connect to APNs Gaterway #246

dorheini opened this issue Feb 25, 2016 · 4 comments

Comments

@dorheini
Copy link

Hi.
I'm having issues with using pushy for push notifications.
i'm using java 7 and tomcat 7.
i have a simple web service on tomcat which sends push notification when directing to specific url.
When doing the following:
final Future<Void> connectFuture = client.connect(ApnsClient.DEVELOPMENT_APNS_HOST);

i get:

io.netty.handler.codec.DecoderException: java.lang.AbstractMethodError
    at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:400)
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:244)
    at io.netty.channel.ChannelHandlerInvokerUtil.invokeChannelReadNow(ChannelHandlerInvokerUtil.java:83)
    at io.netty.channel.DefaultChannelHandlerInvoker.invokeChannelRead(DefaultChannelHandlerInvoker.java:154)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:439)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:162)
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:924)
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:125)
    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)
Caused by: java.lang.AbstractMethodError
    at org.apache.tomcat.jni.SSL.readFromSSL(Native Method)
    at io.netty.handler.ssl.OpenSslEngine.readPlaintextData(OpenSslEngine.java:358)
    at io.netty.handler.ssl.OpenSslEngine.unwrap(OpenSslEngine.java:703)
    at io.netty.handler.ssl.OpenSslEngine.unwrap(OpenSslEngine.java:809)
    at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1092)
    at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:976)
    at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:912)
    at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:369)
    ... 14 more
2016-02-25 13:14:24 WARN  ApplicationProtocolNegotiationHandler:146 - [id: 0xe4d96d17, L:/10.8.1.22:53085 - R:api.development.push.apple.com/17.172.238.203:443] Failed to select the application-level protocol:
io.netty.handler.codec.DecoderException: java.lang.AbstractMethodError
    at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:400)
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:244)
    at io.netty.channel.ChannelHandlerInvokerUtil.invokeChannelReadNow(ChannelHandlerInvokerUtil.java:83)
    at io.netty.channel.DefaultChannelHandlerInvoker.invokeChannelRead(DefaultChannelHandlerInvoker.java:154)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:439)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:162)
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:924)
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:125)
    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)
Caused by: java.lang.AbstractMethodError
    at org.apache.tomcat.jni.SSL.readFromSSL(Native Method)
    at io.netty.handler.ssl.OpenSslEngine.readPlaintextData(OpenSslEngine.java:358)
    at io.netty.handler.ssl.OpenSslEngine.unwrap(OpenSslEngine.java:703)
    at io.netty.handler.ssl.OpenSslEngine.unwrap(OpenSslEngine.java:809)
    at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1092)
    at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:976)
    at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:912)
    at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:369)
    ... 14 more
2016-02-25 13:14:24 WARN  ApplicationProtocolNegotiationHandler:146 - [id: 0xe4d96d17, L:/10.8.1.22:53085 - R:api.development.push.apple.com/17.172.238.203:443] TLS handshake failed:
javax.net.ssl.SSLException: engine closed
2016-02-25 13:14:24 WARN  ApplicationProtocolNegotiationHandler:146 - [id: 0xe4d96d17, L:/10.8.1.22:53085 - R:api.development.push.apple.com/17.172.238.203:443] TLS handshake failed:
javax.net.ssl.SSLException: engine closed

i installed OpenSSL version 1.0.2f and i'm running the above on OSX.
i also added netty-tcnative as dependency to my project as follows:

<dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-tcnative</artifactId>
            <version>1.1.33.Fork14</version>
            <classifier>osx-x86_64</classifier>
        </dependency>

Cant figure out the problem but it seems that something wrong with openssl...
any idea?

@ylgrgyq
Copy link
Contributor

ylgrgyq commented Feb 26, 2016

I got this problem too. I found that pushy 0.5.2 must use netty-tcnative 1.1.33.Fork13 with classifier osx-x86_64, only pushy 0.6-SNAPSHOT can use 1.1.33.Fork14 with classifier osx-x86_64.

You can change the netty-tcnative dependency to :

       <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-tcnative</artifactId>
            <version>1.1.33.Fork13</version>
            <classifier>osx-x86_64</classifier>
        </dependency>

AbstractMethodError means the definition of a method is changed since last compile.

@kduhyun
Copy link

kduhyun commented Feb 26, 2016

@dorheini @ylgrgyq
I had a problem like that.
Here is my solution. The main reason is netty-codec-http2's version is not match with netty-tcnative's version.

pom.xml

<properties>
    <tcnative.classifier>osx-x86_64</tcnative.classifier>
</properties>

    <dependency>
        <groupId>com.relayrides</groupId>
        <artifactId>pushy</artifactId>
        <version>0.5.2</version>
    </dependency>

    <!-- change 4.1.0.CR2 to 4.1.0.CR3 -->
    <dependency>
        <groupId>io.netty</groupId>
        <artifactId>netty-codec-http2</artifactId>
        <version>4.1.0.CR3</version>
        <scope>compile</scope>
    </dependency>

    <!-- latest netty-tcnative. netty's #4840 issue was fixed. (https://github.com/netty/netty/issues/4840 
        ) -->
    <dependency>
        <groupId>io.netty</groupId>
        <artifactId>netty-tcnative</artifactId>
        <version>1.1.33.Fork14</version>
        <classifier>${tcnative.classifier}</classifier>
    </dependency>

@jchambers
Copy link
Owner

I'll try to make the netty-tcnative version requirements clearer in the README (I wasn't really aware that there WERE such specific requirements until these issues started rolling in). Additionally, I've filed a request for more detailed docs with the netty-tcnative folks.

I suspect that adding netty-tcnative to the test matrix (#232) will help a lot.

@dorheini dorheini closed this as completed Mar 1, 2016
@karayv
Copy link

karayv commented Mar 30, 2016

Still reproducible with 1.1.33.Fork15. I've put back 1.1.33.Fork13.

PS. It was tricky to make the library work. I have older Mac OSx and needed to upgrade OpenSSL.
In case anyone needs working gradle script, here is mine:

apply plugin: 'com.google.osdetector'

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.google.gradle:osdetector-gradle-plugin:1.4.0'
    }
}


dependencies {
    // project dependencies here

    // https://github.com/relayrides/pushy
    compile("com.relayrides:pushy:0.5.2")
    compile("io.netty:netty-tcnative:1.1.33.Fork13:$osdetector.classifier")
    runtime("org.eclipse.jetty.alpn:alpn-api:1.1.2.v20150522")
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants