java.lang.NoSuchMethodError: org.apache.tomcat.jni.SSLContext.getMode(J)I

550 views
Skip to first unread message

Guy Jackson

unread,
Aug 15, 2016, 11:47:25 AM8/15/16
to pushy
Hi,

Can anyone help with the above error?

*I think* I have followed the instructions here to the letter.

maven dependencies:

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

<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative-boringssl-static</artifactId>
<version>1.1.33.Fork20</version>
</dependency>

<dependency>
<groupId>org.eclipse.jetty.alpn</groupId>
<artifactId>alpn-api</artifactId>
<version>1.1.3.v20160715</version>
<scope>runtime</scope>
</dependency>


mvn clean install builds without error all tests pass and push notifications can be sent through unit tests.

When I try to deploy to tomcat (9.0.0.0.M9) I get the error:

Caused by: java.lang.NoSuchMethodError: org.apache.tomcat.jni.SSLContext.getMode(J)I
	at io.netty.handler.ssl.OpenSslContext.<init>(OpenSslContext.java:208)
	at io.netty.handler.ssl.OpenSslContext.<init>(OpenSslContext.java:140)
	at io.netty.handler.ssl.OpenSslClientContext.<init>(OpenSslClientContext.java:187)
	at io.netty.handler.ssl.SslContext.newClientContextInternal(SslContext.java:746)
	at io.netty.handler.ssl.SslContextBuilder.build(SslContextBuilder.java:395)
	at com.relayrides.pushy.apns.ApnsClient.getSslContextWithCertificateAndPrivateKey(ApnsClient.java:394)
	at com.relayrides.pushy.apns.ApnsClient.getSslContextWithP12InputStream(ApnsClient.java:388)
	at com.relayrides.pushy.apns.ApnsClient.getSslContextWithP12File(ApnsClient.java:365)
	at com.relayrides.pushy.apns.ApnsClient.<init>(ApnsClient.java:266)
	at com.relayrides.pushy.apns.ApnsClient.<init>(ApnsClient.java:239)

I note this github issue, but it seems to relate to an older version - I have tried the fix none the less.

(MAVEN/SPRING/TOMCAT)

TIA.

Guy



j...@turo.com

unread,
Aug 16, 2016, 9:49:24 AM8/16/16
to pushy
Sadly, it sounds like you're being bitten by an upstream issue where Tomcat's own `tcnative` implementation conflicts with `netty-tcnative`. Please see the wiki for details: https://github.com/relayrides/pushy/wiki/Using-Pushy-in-an-application-container#tomcat-specific-issues

Until the issue is fixed upstream, you should be able to use Pushy in a Tomcat container by using the `alpn-agent` approach (see https://github.com/jetty-project/jetty-alpn-agent) instead of `netty-tcnative`.

Hope that helps!

-Jon

Guy Jackson

unread,
Oct 14, 2016, 5:44:05 AM10/14/16
to pushy
Jon,

Thanks for the response.

Using jetty-alpn-agent did the trick. (I've also upgraded to 0.8.1)

Guy
Reply all
Reply to author
Forward
0 new messages