IOS推送http2使用netty服务启动异常

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了IOS推送http2使用netty服务启动异常相关的知识,希望对你有一定的参考价值。

ios推送http2使用netty服务启动异常

现象

使用netty开发×××送HTTP2,本机运行正常,部署至linux服务器异常。

原因

是linux服务器内核版本过低,所使用GLIBC类库版本过低。netty要求GLIBC_2.10,我的服务器最高才GLIBC_2.5。

linux查看GLIBC版本命令

strings /lib64/libc.so.6 |grep GLIBC_
技术分享图片

解决办法

升级linux内核版本以及GLIBC类库版本。

以下附netty服务器异常日志


2018-11-18 16:54:30 [ appleJobScheduler_Worker-1:64224 ] - [ DEBUG ] io.netty.util.internal.NativeLibraryLoader:91 Unable to load the library: netty-tcnative-linux-x86_64.
java.lang.UnsatisfiedLinkError: /tmp/libnetty-tcnative-linux-x86_648869710963839557158.so: /lib64/libc.so.6: version `GLIBC_2.10‘ not found (required by /tmp/libnetty-tcnative-linux-x86_648869710963839557158.so)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1965)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1890)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1851)
at java.lang.Runtime.load0(Runtime.java:795)
at java.lang.System.load(System.java:1062)
at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:214)
at io.netty.util.internal.NativeLibraryLoader.loadFirstAvailable(NativeLibraryLoader.java:161)
at io.netty.handler.ssl.OpenSsl.loadTcNative(OpenSsl.java:238)
at io.netty.handler.ssl.OpenSsl.<clinit>(OpenSsl.java:65)
at javapns.http2.client.ApnsHttp2Client.getBaseSslContextBuilder(ApnsHttp2Client.java:151)
at javapns.http2.client.ApnsHttp2Client.getSslContextWithCertificateAndPrivateKey(ApnsHttp2Client.java:143)
at javapns.http2.client.ApnsHttp2Client.getSslContextWithP12InputStream(ApnsHttp2Client.java:139)
at javapns.http2.client.ApnsHttp2Client.<init>(ApnsHttp2Client.java:86)
at javapns.http2.client.ApnsHttp2Client.<init>(ApnsHttp2Client.java:82)
at javapns.http2.client.ApnsHttp2.<init>(ApnsHttp2.java:48)
at com.pushservicenotificationios.javapns.http2.config.ApnsHttp2Config.getAppleServer(ApnsHttp2Config.java:53)
at com.pushservicenotificationios.admin.process.ReceiveProcess.receive(ReceiveProcess.java:107)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:269)
at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:257)
at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:75)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
2018-11-18 16:54:30 [ appleJobScheduler_Worker-1:64229 ] - [ DEBUG ] io.netty.util.internal.NativeLibraryLoader:91 Unable to load the library: netty-tcnative-linux-x86_64-fedora.
java.lang.UnsatisfiedLinkError: no netty-tcnative-linux-x86_64-fedora in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1886)
at java.lang.Runtime.loadLibrary0(Runtime.java:849)
at java.lang.System.loadLibrary(System.java:1088)
at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:189)
at io.netty.util.internal.NativeLibraryLoader.loadFirstAvailable(NativeLibraryLoader.java:161)
at io.netty.handler.ssl.OpenSsl.loadTcNative(OpenSsl.java:238)
at io.netty.handler.ssl.OpenSsl.<clinit>(OpenSsl.java:65)
at javapns.http2.client.ApnsHttp2Client.getBaseSslContextBuilder(ApnsHttp2Client.java:151)
at javapns.http2.client.ApnsHttp2Client.getSslContextWithCertificateAndPrivateKey(ApnsHttp2Client.java:143)
at javapns.http2.client.ApnsHttp2Client.getSslContextWithP12InputStream(ApnsHttp2Client.java:139)
at javapns.http2.client.ApnsHttp2Client.<init>(ApnsHttp2Client.java:86)
at javapns.http2.client.ApnsHttp2Client.<init>(ApnsHttp2Client.java:82)
at javapns.http2.client.ApnsHttp2.<init>(ApnsHttp2.java:48)
at com.pushservicenotificationios.javapns.http2.config.ApnsHttp2Config.getAppleServer(ApnsHttp2Config.java:53)
at com.pushservicenotificationios.admin.process.ReceiveProcess.receive(ReceiveProcess.java:107)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:269)
at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:257)
at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:75)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
2018-11-18 16:54:30 [ appleJobScheduler_Worker-1:64232 ] - [ DEBUG ] io.netty.util.internal.NativeLibraryLoader:91 Unable to load the library: netty-tcnative.
java.lang.UnsatisfiedLinkError: no netty-tcnative in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1886)
at java.lang.Runtime.loadLibrary0(Runtime.java:849)
at java.lang.System.loadLibrary(System.java:1088)
at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:189)
at io.netty.util.internal.NativeLibraryLoader.loadFirstAvailable(NativeLibraryLoader.java:161)
at io.netty.handler.ssl.OpenSsl.loadTcNative(OpenSsl.java:238)
at io.netty.handler.ssl.OpenSsl.<clinit>(OpenSsl.java:65)
at javapns.http2.client.ApnsHttp2Client.getBaseSslContextBuilder(ApnsHttp2Client.java:151)
at javapns.http2.client.ApnsHttp2Client.getSslContextWithCertificateAndPrivateKey(ApnsHttp2Client.java:143)
at javapns.http2.client.ApnsHttp2Client.getSslContextWithP12InputStream(ApnsHttp2Client.java:139)
at javapns.http2.client.ApnsHttp2Client.<init>(ApnsHttp2Client.java:86)
at javapns.http2.client.ApnsHttp2Client.<init>(ApnsHttp2Client.java:82)
at javapns.http2.client.ApnsHttp2.<init>(ApnsHttp2.java:48)
at com.pushservicenotificationios.javapns.http2.config.ApnsHttp2Config.getAppleServer(ApnsHttp2Config.java:53)
at com.pushservicenotificationios.admin.process.ReceiveProcess.receive(ReceiveProcess.java:107)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:269)
at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:257)
at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:75)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
2018-11-18 16:54:30 [ appleJobScheduler_Worker-1:64235 ] - [ DEBUG ] io.netty.handler.ssl.OpenSsl:91 Failed to load netty-tcnative; OpenSslEngine will be unavailable, unless the application has already loaded the symbols by some other means. See http://netty.io/wiki/forked-tomcat-native.html for more information.
java.lang.IllegalArgumentException: Failed to load any of the given libraries: [netty-tcnative-linux-x86_64, netty-tcnative-linux-x86_64-fedora, netty-tcnative]
at io.netty.util.internal.NativeLibraryLoader.loadFirstAvailable(NativeLibraryLoader.java:167)
at io.netty.handler.ssl.OpenSsl.loadTcNative(OpenSsl.java:238)
at io.netty.handler.ssl.OpenSsl.<clinit>(OpenSsl.java:65)
at javapns.http2.client.ApnsHttp2Client.getBaseSslContextBuilder(ApnsHttp2Client.java:151)
at javapns.http2.client.ApnsHttp2Client.getSslContextWithCertificateAndPrivateKey(ApnsHttp2Client.java:143)
at javapns.http2.client.ApnsHttp2Client.getSslContextWithP12InputStream(ApnsHttp2Client.java:139)
at javapns.http2.client.ApnsHttp2Client.<init>(ApnsHttp2Client.java:86)
at javapns.http2.client.ApnsHttp2Client.<init>(ApnsHttp2Client.java:82)
at javapns.http2.client.ApnsHttp2.<init>(ApnsHttp2.java:48)
at com.pushservicenotificationios.javapns.http2.config.ApnsHttp2Config.getAppleServer(ApnsHttp2Config.java:53)
at com.pushservicenotificationios.admin.process.ReceiveProcess.receive(ReceiveProcess.java:107)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:269)
at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:257)
at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:75)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
2018-11-18 16:54:30 [ appleJobScheduler_Worker-1:64237 ] - [ DEBUG ] io.netty.handler.ssl.OpenSsl:91 Failed to initialize netty-tcnative; OpenSslEngine will be unavailable. See http://netty.io/wiki/forked-tomcat-native.html for more information.
java.lang.UnsatisfiedLinkError: org.apache.tomcat.jni.Library.version(I)I
at org.apache.tomcat.jni.Library.version(Native Method)
at org.apache.tomcat.jni.Library.initialize(Library.java:176)
at io.netty.handler.ssl.OpenSsl.initializeTcNative(OpenSsl.java:243)
at io.netty.handler.ssl.OpenSsl.<clinit>(OpenSsl.java:76)
at javapns.http2.client.ApnsHttp2Client.getBaseSslContextBuilder(ApnsHttp2Client.java:151)
at javapns.http2.client.ApnsHttp2Client.getSslContextWithCertificateAndPrivateKey(ApnsHttp2Client.java:143)
at javapns.http2.client.ApnsHttp2Client.getSslContextWithP12InputStream(ApnsHttp2Client.java:139)
at javapns.http2.client.ApnsHttp2Client.<init>(ApnsHttp2Client.java:86)
at javapns.http2.client.ApnsHttp2Client.<init>(ApnsHttp2Client.java:82)
at javapns.http2.client.ApnsHttp2.<init>(ApnsHttp2.java:48)
at com.pushservicenotificationios.javapns.http2.config.ApnsHttp2Config.getAppleServer(ApnsHttp2Config.java:53)
at com.pushservicenotificationios.admin.process.ReceiveProcess.receive(ReceiveProcess.java:107)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:269)
at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:257)
at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:75)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
2018-11-18 16:54:30 [ appleJobScheduler_Worker-1:64454 ] - [ DEBUG ] io.netty.handler.ssl.JdkSslContext:76 Default protocols (JDK): [TLSv1.2, TLSv1.1, TLSv1]
2018-11-18 16:54:30 [ appleJobScheduler_Worker-1:64455 ] - [ DEBUG ] io.netty.handler.ssl.JdkSslContext:76 Default cipher suites (JDK): [TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, SSL_RSA_WITH_3DES_EDE_CBC_SHA]

以上是关于IOS推送http2使用netty服务启动异常的主要内容,如果未能解决你的问题,请参考以下文章

Netty构建推送服务问题

SpringBoot基于WebSocket进行推送

实用水文篇--SpringBoot整合Netty实现消息推送服务器

小米推送服务端JAVA HTTP2 SDK/iOS客户端SDK版本发布

尝试在IBM WAS服务器中使用Netty时无法打开输入流错误

使用 Netty HTTP2 实现支持服务器发送事件